Cron Scripts – How to Run Script After 5 or 10 Minutes of System Restart


I have created a ruby script file that checks the connection present or not. For example checking port 22 is opened or not.

Firstly I tried with cron job as follows

@reboot find ${HOME}/my_app/check_conn.rb

But it is executing immediately after starting the system.

Now I have to run this script after 5 or 10 min.

How can I do this. Is there any other way for doing this.

Thanks in advance.

Best Answer

Add sleep 600; to the beginning of your crontab command to make it wait for 600 seconds before proceeding to the next step.

Your new crontab command would look like

@reboot sleep 600; find ${HOME}/my_app/check_conn.rb