![]() |
![]() |
#1 (permalink) |
Insane
Location: Austin, TX
|
cronjob on my server acting weird
I set up a cronjob to automagically record Futurized Radio every monday on www.protonradio.com. Here's the line in my crontab:
55 19 * * mon cd "/tool/storage/MP3s/Electronica/Breaks/Futurized Radio" && /tool/box/bin/streamripper http://64.236.34.196:80/stream/1041 -s -l 8400 >/dev/null 2>&1 & It works quite well, except that at 7:55 every monday, *TWO* of these jobs spawn in rapid-fire succession (so fast, in fact, that the PIDs look like this: PIDn /bin/sh #1 PIDn+1 /bin/sh #2 PIDn+2 streamripper #1 PIDn+3 streamripper #2 I've already checked, double-checked, and triple-checked that I don't have any other crontabs set up. Besides, both of the streamripper processes run under my user id. The only thing I can think of is that I've somehow botched the timing portion of the crontab, causing cron to think it's supposed to run that command twice (once for it being monday, and again for it being 7:55, for example). It also might be that I'm backgrounding the process... Anybody had cron do weird stuff like this? Any suggestions? Thanks! Last edited by skaven; 11-22-2004 at 06:07 PM.. |
![]() |
![]() |
#2 (permalink) |
Professional Loafer
Location: texas
|
For those who don't know...
The 'Cron' Command The cron command starts a process that executes commands at specified dates and times. Regularly scheduled commands can be specified according to instructions found in the crontab files in the directory /var/spool/cron/crontabs. Users can submit their own crontab files via the crontab command. The 'Crontab' Command Crontab copies the specified file or standard input if no file is specified, into a directory that holds all users' crontabs. SYNOPSIS: * crontab [file] * crontab -e [-u username] * crontab -r [-u username] * crontab -l [-u username] The -e option edits a copy of the current users' crontab file or creates an empty file to edit if crontab does not exist. The-r option removes a user's crontab from the crontab directory. The -l options lists the crontab file for the invoking user. Setting up a Crontab job A crontab file consists of lines of six fields each.The fields are separated by spaces or tabs. The first five are integers that specify the following: 1. minute (0-59), 2. hour (0-23), 3. day of the month (1-31), 4. month of the year (1-12), 5. day of the week (0-6 with 0=Sunday). Each of these patterns may be either an asterisk (meaning all valid values) or a list of elements separated by commas. An element is either a number or two numbers separated by a minus sign ( meaning an inclusive range). Notice the time is in 24 hour format, 0 is midnight and 13 is one in the afternoon. The sixth field of a line in a crontab file is a string to be executed by the shell at the specified times by the first fife fields. A percent character in this field (unless escaped by \) is translated to a newline character. Only the first line (up to a % or end of line) of the command field is executed by the shell. The other lines are made available to the command as standard input. Any line beginning with a # is a comment and is ignored. Example To illustrate, 0 0 1,15 1 would run a command on the first and fifteenth of each month, as well as on every Monday at exactly midnight. To specify days by only one field, the other field should be set to *. The entry, 0 23 * * 1 would run a command only on Mondays at eleven PM. A minute specification of 0,30 would indicate the job is to be run on the hour and half hour. Likewise, a day of the month entry of 1,15 would initiate execution on the first and fifteenth of the month. Make sure you include an explicit path to your programs or scripts that you want to run by crontab. Let's assume we want to execute a Perl program, autoclose.cgi, every day at midnight. Additionally assume the full path to the script is /home/www/yourdirectory/cgi-bin. The full crontab command would be: 0 0 * * * /home/www/yourdirectory/cgi-bin/autoclose.cgi
__________________
"You hear the one about the fella who died, went to the pearly gates? St. Peter let him in. Sees a guy in a suit making a closing argument. Says, "Who's that?" St. Peter says, "Oh, that's God. Thinks he's Denny Crane." |
![]() |
![]() |
#4 (permalink) | ||
Insane
Location: Austin, TX
|
Quote:
Quote:
|
||
![]() |
Tags |
acting, cronjob, server, weird |
|
|