Skip to first unread message

ricky...@gmail.com

unread,
Nov 28, 2016, 6:43:43 AM11/28/16
to BeagleBoard
Hi,

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?

Kernel version:
Linux beaglebone 4.4.34-ti-r69 #1 SMP Wed Nov 23 20:01:14 UTC 2016 armv7l GNU/Linux


Thanks for the help!

Best Regards,

Ricky Chang

Stephane Charette

unread,
Nov 28, 2016, 1:15:34 PM11/28/16
to BeagleBoard
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:

cat /etc/cron.d/startup_scripts
MAILTO=""
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

@reboot root /home/stephane/scripts/check_for_upgrade.sh
@reboot root /home/stephane/scripts/startup_commands.sh

Stéphane

ricky...@gmail.com

unread,
Nov 29, 2016, 5:57:46 AM11/29/16
to BeagleBoard
Hi Stephane, 

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!

Peter Lawler

unread,
Nov 29, 2016, 11:36:37 PM11/29/16
to beagl...@googlegroups.com, ricky...@gmail.com


On 28/11/16 22:43, ricky...@gmail.com wrote:
> Hi,
>
> I am trying to run some simple startup shell scripts when the system boots.

Hi,
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...

https://github.com/PeteLawler/starnix-recipes/blob/master/etc/systemd/system/bb-leds-off.service

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.

Cheers,

Pete.

ricky...@gmail.com

unread,
Dec 2, 2016, 12:12:31 AM12/2/16
to BeagleBoard, ricky...@gmail.com
Hi Peter,

Thanks for the template!
Reply all
Reply to author
Forward
0 new messages