I wrote:
| Hi Managers,
|
| I would like to write some cronjobs that write data to a file
| in the *current* syslog.dated subdirectory.
|
| Is there any way I can determine easily which one is the current one?
|
| (I know,
| ls -t /var/adm/syslog.dated | head -1
| should do the trick, but I'd like to avoid running that all the time)
|
| I was hoping that syslogd kept a symlink to the current directory somewhere,
| but I canot find anything.
|
| Does anyone have any hints...?
|
| This is for DU3.2 and DU4.0
1. One reply stated that it might be (actually the author said he hoped that
it would be) /var/adm/syslog, which it did not turn out to be on my
DU boxen :-(
2. Some suggested running a cronjob at midnight (and maybe also at reboot)
performing the links. However, this does not help if syslogd receives
any HUP signals (or gets restarted) at other times, as syslogd then creates
a new directory which would obviously not be linked...
So this is not a viable option if the directory must absolutely be the current
one...
This reply however made me think of the following:
If DU syslogd supported piping the message to a command, it might
be possible to construct a script, when called through
syslog itself:
in /etc/syslog.conf
syslog.debug /var/adm/syslog.dated/syslog.log
syslog.debug | /usr/local/bin/mysysloglinker
mysysloglinker:
#!/usr/local/bin/perl
while (<>) {
chomp;
/syslogd: restart/ && do {
$lastdir = `ls -t /var/log/syslog.dated | head -1`;
This way each time syslog started, it would execute the relinking script
However, DU (at least 3.2) syslogd does not provide this feature (piping
messages, so this option is out :-(
(Linux syslogd can do this, but they don't use syslog.dated anyway :-)
3. Other suggested just using the logger(1) command to write messages to the syslog.
While this will ensure that the messages end up in the correct directory,
however, this means that one will have touse one of the syslog facilities, and
cannot create arbitrary file...
I ended up using option 3 for the time being, but may go back to doing the
ls -t | head -1 trick for each job to get it right...
Thanks to all who replied.
Mathias
Mathias Koerber | Tel: +65 / 471 9820 | mathias_at_staff.singnet.com.sg
SingNet NOC | Fax: +65 / 475 3273 | mathias_at_koerber.org
Q'town Tel. Exch. | PGP: Keyid: 768/25E082BD, finger mathias_at_singnet.com.sg
2 Stirling Rd | 1A 8B FC D4 93 F1 9A FC BD 98 A3 1A 0E 73 01 65
S'pore 148943 | Disclaimer: I speak only for myself
* Eifersucht ist eine Leidenschaft, die mit Eifer sucht, was Leiden schafft *
Received on Thu Mar 26 1998 - 03:28:48 NZST