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



  • Spruce Grove

    Dang this is awesome! Thanks for sharing Dominique

  • run 3

    Thanks for sharing Dominique


    Did not know about this alternative command . Thanks for sharing.

  • bat

    thank you for this! really appreciate you doing this

  • respite care

    It’s good! Thank you very much!