[NBLUG/talk] Odd cron problem

Walter Hansen gandalf at sonic.net
Mon Dec 20 16:08:24 PST 2004


That did it. Hmmm. A little bit of knowledge goes a short way, what did I
do wrong?

Any suggestions on where to look for stuff like this?

I also want to be able to send signals to one process that will cause it
to re-read configuration and I want to have several processes communicate
short strings with each other. (one process) -> (short string) -> (all the
rest) and they then remove the short string data from their configuration
and continue. I'm thinking I'll have to get good with sockets.

Any good web-manuals???

> On Sun, Dec 19, 2004 at 05:06:57PM -0800, Walter Hansen wrote:
>> 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: $!";
>>   }
>
> Does it work if you add:
>
> $|=1; select(STDERR); $|=1; select(STDOUT);
>
> ?
>
>  -Scott
>
>
>
>>
>>
>>
>> > 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
>> >
>> >
>>
>>
>>
>> _______________________________________________
>> talk mailing list
>> talk at nblug.org
>> http://nblug.org/cgi-bin/mailman/listinfo/talk
>
> _______________________________________________
> talk mailing list
> talk at nblug.org
> http://nblug.org/cgi-bin/mailman/listinfo/talk
>
>






More information about the talk mailing list