Re: multilog error logging dnscache - supervise don't run

John Simpson <[email protected]> Sun, 5 Oct 2008 11:51:31 -0500
Newsgroups gmane.comp.djb.syslog
Message-ID <[email protected]>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2008-09-30, at 1558, soko.tica wrote:
>
> Reported errors are:
> # ps auxww
> ...
> root      7958  0.0  0.2   196   380 ??  S      9:53AM    0:09.38
> readproctitle service errors: ...rt supervise/run: file does not
> exist\n./run[2]: log-crucial-data: not found\nsupervise: fatal: unable
> to start supervise/run: file does not exist\
> ...
>
> Scripts content:
>
> # cat /service/log/run
> #!/bin/sh
> exec log-crucial-data
> exec setuidgid cruxlog multilog t ./main

(1) the error message you're seeing is because "log-crucial-data" does  
not exist in the PATH under which this script runs. you should either  
explicitly set the PATH variable at the top of your "run" script, or  
(this is how i would do it) explicitly specify the full path to the  
"log-crucial-data" program.

(2) you need to study your shell scripting a little more...  
specifically, learn what "exec" means.


> # cat /service/run
> #!/bin/sh
> echo starting
> exec clockspeed
> exec 2>&1

(3) as paul has already pointed out, your directory structure is  
wrong. each directory "/service/x" represents one service. each  
service directory has a "/service/x/log", which receives the logs from  
the service running in its parent directory. my own server has a  
directory structure like this:

/var/service/dnscache/
/var/service/dnscache/run
	(created by dnscache-conf, not changed)
/var/service/dnscache/log/
/var/service/dnscache/log/run
	#!/bin/sh
	exec setuidgid dnslog multilog t ./main
/var/service/dnscache/log/main/ (owned by userid "dnslog")

and then "/service/dnscache" is a symlink to "/var/service/dnscache".


so probably what you want is:

/var/service/clockspeed/ (root:root 0755)
/var/service/clockspeed/run (root:root 0744)
	#!/bin/sh
	echo starting
	exec /usr/bin/clockspeed 2>&1
/var/service/clockspeed/log/ (root:root 0755)
/var/service/clockspeed/log/run (root:root 0744)
	#!/bin/sh
	exec setuidgid cruxlog multilog t ./main
/var/service/clockspeed/log/main/ (owned by userid "cruxlog", 0700)

(i'm not sure how your "log-crucial-data" program is supposed to fit  
in here, you haven't told us what it does or how it works.)


> I think that the problem is ... I messed up something in scripts,
> since I don't know how to write them.

that's a big part of it. if you're going to manage servers, you pretty  
much have to know scripting- shell scripting is a basic requirement,  
and perl can make your life a lot easier as well (although it's not  
"as" required as shell scripting is.)


- --------------------------------------------------------
| John M. Simpson  --  KG4ZOW  --  Programmer At Large |
| http://www.jms1.net/                 <[email protected]> |
- --------------------------------------------------------
|   Hope for America  --  http://www.ronpaul2008.com/  |
- --------------------------------------------------------





-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkjo8JMACgkQj42MmpAUrRrvPgCfRaHhLDzo5wc1aLKJHBH1j5nP
S5cAnAnhEOyqahWfCLmHrMLOT6jwuPId
=u9Vg
-----END PGP SIGNATURE-----