[NBLUG/talk] Odd cron problem
Walter Hansen
gandalf at sonic.net
Sun Dec 19 17:06:57 PST 2004
Ok, this is odd. I reset it up in cron so that each process is run
individually and I get the same result. I've got this code in the
beginning of the program to fork it as a daemon and redirect output to a
log file. Anybody got anything on this?:
unless ($test)
{
chdir '/' or die "Can't chdir to /: $!";
umask 0;
open STDOUT, ">>$access_log" or die "Can't write to $access_log: $!";
open STDERR, ">>$error_log" or die "Can't write to $error_log: $!";
open STDIN, '/dev/null' or die "Can't read /dev/null: $!";
defined(my $pid = fork) or die "Can't fork: $!";
exit if $pid;
setsid or die "Can't start a new session: $!";
}
> I've got a perl program that forks itself and then redirects output to a
> file to run as a daemon. I've now implemented a little shell script that
> simply runs 11 such processes with command line options so each logs to a
> different file. I also have a cron event that starts these at a certain
> time as user root. I used to have 11 cron events, one for each process,
> but decided it would be simpler to have cron start one script that starts
> them all.
>
> Now when I run the script manually, everything goes fine. When I had cron
> start each process individually everything went fine. But when I have the
> script start them through cron the log files all show up as if I'd issued
> a touch command (size 0). They should start getting information
> immediately and then slow down to more every minute or so. I think perhaps
> it's somehow being buffered, but I don't see how as all I've done is place
> the program startup commands in the script file and made it executable.
> Perhaps I'm missing something. It's been a while since I've fooled with
> shell scripts.
>
> [root at abco nus]# cat attacktonight
> /root/nus/nus --die 30 --user marilyn
> /root/nus/nus --die 30 --user walter
> /root/nus/nus --die 30 --user robert
> /root/nus/nus --die 30 --user danny
> /root/nus/nus --die 30 --user donald
> /root/nus/nus --die 30 --user mary
> /root/nus/nus --die 30 --user dennis
> /root/nus/nus --die 30 --user arron
> /root/nus/nus --die 30 --user kevin
> /root/nus/nus --die 30 --user marci
> /root/nus/nus --die 30 --user jill
> [root at abco nus]#
>
> No, despite the name, this is not a malicious program. It's a competitive
> program and the admin of the other system is well aware of this process as
> well as all the others that do similar things.
>
>
> _______________________________________________
> talk mailing list
> talk at nblug.org
> http://nblug.org/cgi-bin/mailman/listinfo/talk
>
>
More information about the talk
mailing list