On Sat Dec 15, 2001 at 03:28:14AM +0100, Wolfgang Bornath wrote: [...] > The important thing missing here is the automatic start of the script. > The script is nice but I still have to punch 'sig' (or whatever I call > the script) into an xterm before I start writing a mail. > What I'd like is: whenever I type 'm' or 'r' or any command in my mutt to > write a mail or reply to a mail I want this script generate the current > signature which mutt puts under my mail body. > > One possible solution may be running the script by a cron job every 5 > minutes during 'mail writing hours'.
bah... you don't want to do that. Here... this is the easy way to do
it. In your mutt config file use:
set signature='~/bin/uptime.pl ~/.signature|'
Then use the below uptime.pl script I wrote and throw it wherever you
like (I assume ~/bin):
#!/usr/bin/perl
$home = $ENV{"HOME"};
# get current uptime
$uptime = `linux_logo -g -a -F "#U"`;
@uptime = split(/Uptime /,$uptime);
@disp = split(/minute/,$uptime[1]);
$kernel = `uname -r`; chop $kernel;
$disp = "Current Linux kernel $kernel uptime: $disp[0]minutes.";
if ($#ARGV lt 0 or $#ARGV gt 1) {
print "Usage: $^X sigfile\n";
exit(1);
}
open (SIG, "$ARGV[0]") or die "Can't open $ARGV[0]";
while (<SIG>) {
$sig .= $_;
}
print "$sig\n\n$disp\n";
#open (SIG,">$home/.sig");
#print SIG "-- \n$sig\n\n$disp";
#close SIG;
exit(0);
Then have ~/.signature contain whatever you want (in my case the two
lines mentioning pgp stuff), and then you will have the last line like
in my sig below.
Customize it to suit your needs.
--
MandrakeSoft Security, OpenPGP key available on www.keyserver.net
1024D/FE6F2AFD 88D8 0D23 8D4B 3407 5BD7 66F9 2043 D0E5 FE6F 2AFD
Current Linux kernel 2.4.8-34.1mdk uptime: 25 days 4 hours 51 minutes.
msg46148/pgp00000.pgp
Description: PGP signature
