0

I created a script in /etc/init.d called hello that does some bash commands. Sometimes when I restart the linux device (remove then reinstate power), the contents of my script get totally erased although the actual file is still there. There is another script in there called nginx that came with the system and doesn't have this problem.

I am running a Emlid RTK gps that has a linux computer built in.

0

You should not turn off the device taking off the power cord/battery; hence losing the contents of recently written files.

Try to use the official procedures to shut it down - power bottom or option in the menu; in the long term the device will be more stable.

Also if you have got the sync command, use it after writing your file.

  • Is that the cause of the file going blank though? – bakalolo Jan 16 '18 at 22:00
  • Most probably yes. – Rui F Ribeiro Jan 16 '18 at 22:06
  • You have got to run something before shutdown. sync has been the standard for decades now. Have you got it? – Rui F Ribeiro Jan 16 '18 at 22:13
  • Can't say I will get access to the device to run anything before power off can I make a script that runs sync when it starts up or periodically while power is on? – bakalolo Jan 16 '18 at 22:19
  • You can run sync manually after creating the script in init.d if you have the command. I do know neither the implementation nor the device to be of further help. – Rui F Ribeiro Jan 16 '18 at 22:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.