Re: Executed programs appending to syslog.

From: Peter Ajamian (peter@pajamian.dhs.org)
Date: 03/09/01


"Shane P. Lee" wrote:
>
> I have a small function that is called whenever the first player after
> a reboot/fold logs in that runs a program with system().
> Example (Not actual code):
> #define PRGM "Program"
> #define FLAG "-v"
> #define COMS "myfile"
>
> void run_prgm(void)
> {
>  sprintf(buf, "%s %s %s nohup&", PRGM, FLAG, COMS);

nohup should go in front (if you really need it), like this...

sprintf(buf, "nohup %s %s %s&", PRGM, FLAG, COMS);

Why do you want to run it nohup anyways?  It has nothing to do with where
the output of the program goes.

>  system(buf);
> return;
> }
>
> Now, all I have to do is run a few basic checks and then do a
> run_prgm();
> The Good News: "&" works. It allows the program to run as a background
> process.
> The Bad News: "nohup" doesn't work. Everything is appended to the MUD
> syslog.
>
> I was thinking of doing something like "%s %s >> logfile&" but I'm
> not entirely sure that will work, besides I don't even WANT a log of
> what this program is doing.

Then do...

sprintf(buf, "nohup %s %s %s>/dev/null&", PRGM, FLAG, COMS);

You will still see messages which the program sends to stderr in the
syslog, if you want to get rid of those do...

sprintf(buf, "nohup %s %s %s&>/dev/null&", PRGM, FLAG, COMS);

> Everthing appended to syslog from this program begins with "^M" which
> leads me to believe that I could possibly catch it all before it gets
> recorded, but I'm not sure how to do that.

Hrmmm, that's interesting, sounds like some kind of strange
windblows/*nix clash.

What is this program anyways?

Regards, Peter

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/04/01 PST