add flush() after every write
switch from shutdown to reboot due to sudoer rules