Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command to execute a script later

I would like to execute a script after 12 hours. I could execute the script by remote access, but problem is I will be travelling by flight and may not have internet access. So I was wondering if there is some command to execute a script after few hours or at some specific time. e.g.,

cat my_script.sh
echo Hello World
run my_script.sh at 23:00 hr
like image 979
Kay Avatar asked Dec 10 '22 09:12

Kay


2 Answers

Take a look at the man page for at

man at

There are lots of ways you can specify the time. You can do something like:

at -f my_script.sh 23:00
like image 107
Ken Schumack Avatar answered Dec 14 '22 19:12

Ken Schumack


Use cron job in linux. like

0 */12 1 11 3 /bin/execute/my/script.sh >/dev/null 2>&1
like image 35
MSQ Avatar answered Dec 14 '22 19:12

MSQ