0

Forgive me, I am newer to Linux/Debian/Raspian.

The company I work for has a bash script being run from rc.local that updates /etc/hostname file on bootup of a raspberry pi based on the MAC Address of one of the network interfaces found on said pi, keeping the hostnames unique for each unit.

We also have an executable being run from systemd (sudo systemctl enable [executable-name]) that reads this /etc/hostname file first thing when it starts to see what it's hostname is.

We are finding occasionally after we image the SD card with this script on it that our executable is starting up/reading this /etc/hostname file and getting the old hostname read into memory in the executable. (Second boot is ok because the script has already written to the /etc/hostname file at least once the correct information).

Is there a way to set up the systemd executable to wait till the rc.local bash file has finished completely before starting the systemd executable. Some Requires variable or something.

  • The best course of action will be to convert the rc.local to a unit file and use systemd's dependency system. systemd's sysv compatibility is poor and you will waste time trying to game it. – Mark Wagner Feb 15 at 0:08

Your Answer

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

Browse other questions tagged or ask your own question.