python ipmitool reboot issue in Linux

49 views Asked by At

here is the thing, I created a txt file with string used python first, so far, everything is normal. then used ipmitool to reboot, but the txt file is empty when OS boot up.

with open('test.txt','a+') as f:
 f.write('test')

os.system('sudo ipmitool chassis power reset')

I have no idea how this happened, is there any possible reasons may cause this? BTW, if manually execute ipmitool, it's normal too.

1

There are 1 answers

1
leo On BEST ANSWER

add sync command before ipmitool chassis power reset. It will flush buffers to permanent storage.

sync; ipmitool chassis power reset