[kwlug-disc] Scripting in Linux and unit.d

John Van Ostrand john at netdirect.ca
Wed Jan 11 11:49:23 EST 2012


----- Original Message -----
> Depending on what you are trying to do, you can do away with rsyslog,
> and use logrotate, with a prerotate and/or postrotate script.

I think what Khalid meant was that you can do away with the rsyslog method of splitting log files. Rsyslogd is a useful system process that should stay in place.

Logrotate's main use is to split and compress log files based on size. The post-rotate script option allows you to run commands after the log file has been split. You could run your script here if you are fine having the file split on logrotate's schedule. If the file is too huge to process at split time or you want minute-by-minute splitting a perl script running against a named pipe combined with rsyslogd logging to that named pipe is one way to achieve that. In this case you would run your perl script as a "respawn" process under init so that in the event it dies it is immediately restarted.

e.g.

/etc/rsyslog.conf
=================
local7.*             /var/run/minecraft.pipe

/etc/inittab
============
lg:2345:/usr/local/bin/minecraft_split.pl

Linux commands
==============
# mkfifo /var/run/minecraft.pipe
# telinit q
# /etc/rc.d/rsyslogd restart



-- 
John Van Ostrand 
CTO, co-CEO 
Net Direct Inc. 
564 Weber St. N. Unit 12, Waterloo, ON N2L 5C6 
Ph: 866-883-1172 x5102 
Fx: 519-883-8533 

Linux Solutions / IBM Hardware 





More information about the kwlug-disc mailing list