Am Mit, 2003-10-29 um 23.49 schrieb Jim Frank:
> Script is up and running.  The only issue I'm having is with the rotation of
> xmail's logs.  I've got them set to rotate by default, (2300) and have my
> pop3, smtp and smail logs showing as a day behind (their filenames).  Can
> anyone point me to a sh script or another way to auto symbolically link
> these files with the current date?
> 

heres a little script which i run via crontab:

in /etc/crontab:
-----------------------------------------------------------
08 00   * * *   root    (/var/MailRoot/bin/xmail_logs_link)
-----------------------------------------------------------

/var/MailRoot/bin/xmail_logs_link:
-----------------------------------------------------------
#!/usr/bin/perl -w

my ($se, $mi, $st, $mo, $mt, $ja, $wt, $jt, $sz) = localtime(time);
$mt+=1; $ja+=1900; $jt+=1; # $mo-=1;
$mt = $mt < 10 ? $mt = "0".$mt : $mt;
$mo = $mo < 10 ? $mo = "0".$mo : $mo;
$st = $st < 10 ? $st = "0".$st : $st;
$mi = $mi < 10 ? $mi = "0".$mi : $mi;
$se = $se < 10 ? $se = "0".$se : $se;
my ($heute) = "$ja"."$mt".$mo."0000";

($se, $mi, $st, $mo, $mt, $ja, $wt, $jt, $sz) = localtime(time-86390);
$mt+=1; $ja+=1900; $jt+=1; # $mo-=1;
$mt = $mt < 10 ? $mt = "0".$mt : $mt;
$mo = $mo < 10 ? $mo = "0".$mo : $mo;
$st = $st < 10 ? $st = "0".$st : $st;
$mi = $mi < 10 ? $mi = "0".$mi : $mi;
$se = $se < 10 ? $se = "0".$se : $se;
my ($gestern) = "$ja"."$mt".$mo."2300";

my ($cmd1) = "touch /var/MailRoot/logs/pop3-".$gestern."; ln -s \
/var/MailRoot/logs/pop3-".$gestern."/var/MailRoot/logs/pop3-".$heute;

my ($cmd2) = "touch /var/MailRoot/logs/smail-".$gestern."; ln -s \
/var/MailRoot/logs/smail-".$gestern." /var/MailRoot/logs/smail-".$heute;

my ($cmd3) = "touch /var/MailRoot/logs/smtp-".$gestern."; ln -s \
/var/MailRoot/logs/smtp-".$gestern." /var/MailRoot/logs/smtp-".$heute;

`$cmd1`;
`$cmd2`;
`$cmd3`;

-----------------------------------------------------------


hope this helps,

- Achim

-
To unsubscribe from this list: send the line "unsubscribe xmail" in
the body of a message to [EMAIL PROTECTED]
For general help: send the line "help" in the body of a message to
[EMAIL PROTECTED]

Reply via email to