|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
the "at" command
I am trying to write a script that performs various commands. I would like to set the script to run at various times but can find a way to set this up. I would also like to keep a log file of each time the script is run. Any help on this would be great!
|
|
#2
|
|||
|
|||
|
Any chance you'd want to use cron instead of at? The at command seems kinda limited for repeat usage of a script, since it only accepts one argument for time, as far as I can tell. Cron would be better for you to routinely execute jobs at certain times, and is very easy to set up. man cron.
-Gary |
|
#3
|
|||
|
|||
|
I got cron up and running, but when I run the script in the backround, i can't get it log the whole activity of the script since nothing is written to standard output. I was using tee -a to log the output of each command, which works fine if I run the script from the console, but when I run the script in the backround, nothing gets logged. What can I do to log from the backround?
|
|
#4
|
|||
|
|||
|
Redirect the output of the script from cron... In the crontab, make the calling line appear like so:
* * * * * * /path/to/script > /path/to/logfile.txt That will log your output to a file which you can read later. Or, you can alternatively log output from the script you're running as well, which will avoice the problem altogether. -Gary |
|
#5
|
|||
|
|||
|
Ok, here is my problem. I need to run a script to ping and traceroute various site at different times of the day for one of my classes. I have a script set up that does everything, but when I set the script to output to a log file in cron, it will output certain things, like the date command, but things like ping don't output anything at all. What other ways are there to log from cron other than just script > logfile?
|
|
#6
|
|||
|
|||
|
in your /etc/crontab you can specify:
MAIL=root Then cron will mail the outputs of the programs (if any) to root. But you can also modify the lines above to log stderr too: * * * * * * /path/to/script > /path/to/logfile.txt 2>&1
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > BSD Help > the "at" command |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|