This article demonstrates how to run a cron job automatically after a server reboot. For example, you may want to run a particular script file or application after a server restarts.
To do this, use the @reboot crontab directive in the cron job instead of a particular day or time. For example, the following cron job runs the start_application.sh script file in the user's home directory one time only after the system restarts:
@reboot ${HOME}/start_application.sh
For more information about the @reboot directive and other directives you can use in cron jobs, type the following command at the command prompt:
man 5 crontab
Subscribe to receive weekly cutting edge tips, strategies, and news you need to grow your web business.
No charge. Unsubscribe anytime.
Did you find this article helpful? Then you'll love our support. Experience the A2 Hosting difference today and get a pre-secured, pre-optimized website. Check out our web hosting plans today.
We use cookies to personalize the website for you and to analyze the use of our website. You consent to this by clicking on "I consent" or by continuing your use of this website. Further information about cookies can be found in our Privacy Policy.