I am trying to run some simple startup shell scripts when the system boots. It used to be an easy task by putting the script in /etc/init.d. But now with systemd I have no idea how this can be done. I’ve tried to put them in etc/rc.local, etc/init.d, but the scripts don’t seem to run. I’ve seen some tutorials to put the scripts in a service with systemctl, which I haven’t yet tried. But there must be some other ways?
Linux beaglebone 4.4.34-ti-r69 #1 SMP Wed Nov 23 20:01:14 UTC 2016 armv7l GNU/Linux
Thanks for the help!
I am trying to run some simple startup shell scripts when the system boots.
One thing I tend to use is the @reboot keyword in cron. For example:
@reboot root /home/stephane/scripts/check_for_upgrade.sh
@reboot root /home/stephane/scripts/startup_commands.sh
Yes crontab will work. I’ve also found that rc.local did run only for some reasons it couldn’t execute my scripts, I’d look into that further. Thanks for the help!
If you're after a simple 'single shot' startup, you can use this as a template. I wrote this one because the flashing LEDs seemed to ... distract ... the pets at night...
Instructions on how to install it are in the comments.
I believe there are ways to have your old style SysV init scripts work with systemd, but I'd suggest for future proofing sake you may be better off just going with the flow.