Using crontab to Startup Service
Join the DZone community and get the full member experience.Join For Free
Did you know that crontab service has the "@reboot" schedule that would start a script during your system startup time? This is handy if you want something to run right after your system has stared. Try this:
# crontab -e @reboot $HOME/crontab/runcmd.sh /apps/start-myapp.sh
The disadvantage of this vs the rc.d scripts are you do not have control on when the system shutdown("stop") state. So if your app doens't need to clean up during shutdown, but only care to start when during reboot, this would be an easy option.
Published at DZone with permission of Zemian Deng, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.
A Data-Driven Approach to Application Modernization
Which Is Better for IoT: Azure RTOS or FreeRTOS?
How To Scan and Validate Image Uploads in Java
File Upload Security and Malware Protection