Results 11 to 14 of 14
Checkout things like crontab or at command Linux Crontab: 15 Awesome Cron Job Examples Understand at, atq, atrm, batch Commands using 9 Examples...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 05-29-2013 #11
- 05-29-2013 #12
- Join Date
- May 2013
I have looked at those sites, but they did not help, I cant get the "at now + 1 min" to go along with start, stop or restart a process.
To start a process I just write the path to it, and I have to use the PID to kill it, is there any other way? to start, stop and restart using 'at'?
- 05-29-2013 #13
I'm not too familiar with 'at' but I would do something like invoke a script via 'crontab' file.
The script will do the following
1)Start the process-A
2)Get pid of the process using 'echo $!'
2.1)Sleep for 120 seconds
3) kill the process id obtained in step 2
4)Start the process again
- 05-29-2013 #14
Taking the Apache web server as an example I can do the following as root:
at now +2 min<ENTER> systemctl restart apache2<ENTER> <CTRL+D>
at now +2 min<ENTER> service httpd restart<ENTER> <CTRL+D>
#!/bin/bash mkdir test cd test echo "Hello world" > hello.txtCode:
chmod +x test.sh
at now +2 min<ENTER> ~/Documents/scripts/test.sh<ENTER> <CTRL+D>
Last edited by elija; 05-29-2013 at 04:37 PM. Reason: Forgot to mark it executable among other things!"I used to be with it, then they changed what it was.
Now what was it isn't it, and what is it is weird and scary to me.
It'll happen to you too."
The Fifth Continent