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.

Lightsout
  • 165

2 Answers2

1

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.

Rui F Ribeiro
  • 56,709
  • 26
  • 150
  • 232
0

This is speculation, as I don't know anything about this product.

It's possible the entire filesystem has been overwritten.

In many embedded systems the running filesystem lives in RAM, and is populated from a compressed image in flash (or similar) during a cold boot.

Alternately a software update may have occurred, which involved replacing the filesystem with a downloaded image.

On such systems, user settings tend to be stored on a separate filesystem.

Grump
  • 225