mcrblg-header-image

search

You can use the @reboot keyword in crontab to start a shell script at system startup but here is why this isn’t a very good solution to do that.

The problem is that if you don’t shut down the system cleanly on the next startup this message will pop up and cron will simply skip over running your command.

"Skipping @reboot jobs -- not system startup"

The solution is easy, just use a systemd service.

/etc/systemd/system/service_name.service
------------------------------------------
[Unit]
Description=some description
After=network.target
StartLimitIntervalSec=0

[Service]
Type=simple
User=root
ExecStart=/home/user/script.sh

[Install]
WantedBy=multi-user.target

 

UnixDaemon – How Does Cron Reboot Work

Leave a Reply

Your email address will not be published. Required fields are marked *

close
menu