Running commands after reboot via cron

Did you ever had to execute a command as soon as the server has rebooted? Of course you can use traditional methods like SysV init scripts, or systemd service units, but this will only work if you’ve root access to the host in question.

If you don’t have root access, but cron is enabled, then there’s an alternative. Just edit your personal crontab file w/ crontab -e , and add your desired command with the prefix @reboot to your crontab:

@reboot ~/bin/my-command


Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.