Results 11 to 14 of 14
Thread: Simple command help!
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 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'?
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
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 03:37 PM. Reason: Forgot to mark it executable among other things!Should you be sitting wondering,
Which Batman is the best,
There's only one true answer my friend,
It's Adam Bloody West!
The Fifth Continent