Linux notebook / daemontools
Description: Documents various Linux or *nix programs and concepts, including qmail, djbdns, emacs, Perl, hardware, bash, TCP/IP, DNS, etc...
Keywords: find djbdns system dns typical bash less gdb daemontools mirrordir math tables mysql qmail isdn make http ezmlm shell pppd cftp regexps intro awk dhcp test hardware ucspi-tcp apache html perl php3 fetchmail versions emacs email peripherals

Apache Awk Bash C cftp daemontools DHCP djbdns DNS Emacs Email ezmlm Fetchmail find GDB Hardware HTML HTTP Intro ISDN less Make Math mc mirrordir MySQL Peripherals Perl PHP3 pppd qmail Regexps Shell System Tables test To do Typical ucspi-tcp Versions Index TCP/IP slides
daemontools |
svc | svstat | multilog
| top

> svc - controlling services

> svc
> svc controls services monitored by supervise svc opts services
> -u | Up: if the service is not running, start it. If the service stops, restart it | -d | Down: if the service is running, send it a TERM signal, and then a CONT signal. After the service stops, do not restart it
> -o | Once: If the service is not running, start it. If it stops, do not restart it | -p | Pause: send the service a STOP signal
> -c | Continue: send the service a CONT signal | -h | Hangup: send the service a HUP signal
> -a | Alarm: send the service a ALRM signal | -i | Interrupt: send the service a INT signal
> -t | Terminate: send the service a TERM signal | -k | Kill: send the service a KILL signal
> -x | Exit: exit supervise as soon as the service is down | services | One or more complete paths to directories controlled by supervise

> svstat - service stats

> svstat
> svstat show the status of services monitored by supervise svstat services

> multilog - logging program

> multilog
> multilog reads lines from stdin and appends selected lines to any number of log files, automatically rotated multilog scriptexpressions Input lines are selected by default, and to each line the following scriptexpressions may be applied
> -pattern | Minus: deselects the line if the pattern is matched | The pattern is made of stars and non-stars Non-stars match themselves Stars match any string not containing the character following them If at end of pattern, a star matches any string
> +pattern | Plus: selects the line if pattern is matched
> e | Errors: prints the first 200 bytes of the line to stderr | =file | Copy: writes the line, if selected, to file, overwriting it
> t | Timestamp: inserts a TAI timestamp at the start of the line Must be used as the first script expression | .dir /dir | Directory: if the scriptexpression begins with a dot or slash, it designates the directory where the log files are kept. If the directory does not exist, it is created.
> s123456 | Size: defines the maximum size for the log file, which is rotated before reaching that size. The size is in bytes, from 4096 and 16777215, with a default of 99999 | n12 | Number: number of old rotated logs to keep, default is 10, minimum is 2
> !command | Shell: defines the command that is run when the current log file is rotated |  |

> Sample multilog command to auto-rotate and compress the log files

> multilog t s131072 n100 '!/bin/gzip' /var/log/logdir

> This rotates the logs when they are near 128k bytes in length, gzipiping the rotated logs. Up to 100 log files will be kept. A time stamp will be added at the start of each line. The log directory is /var/log/logdir.

Last update: Wed, 2 Nov 2005 10:16:21 GMT | top