Re: Dynamic E-Mail Signatures

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, 2002-12-14 at 05:23, Jonathan M. Slivko wrote:
> Hello,
> 
> I noticed that Rick and a few other people are using dynamic e-mail signatures 
> for this list, I was wondering how I can do the same using Evolution. Please let 
> me know, thanks.

Surely this is the ultimate way!  A signature that changes every time
you read it!  (using pipes, but you don't need to know what they are to
use it)  Save the attachment somewhere (ie ~/signature.pl) and then put
in, say, .bashrc the line:
~/signature.pl &
Now point your signature in your favourite mail client to ~/.signature
Every time you read it you will get a different fortune.  If you don't
have the extra fortunes used, you can make the line that says
print FIFO "$FULLNAME $EMAILADDR\n",`fortune 25% homer 25% startrek 25% futurama 25% kernelcookies -s`;
(one line) into
print FIFO "$FULLNAME $EMAILADDR\n",`fortune -s`;
or choose your favourite from /usr/share/games/fortune.

-- 
Iain Buchanan <iain@nospam.pcorp.com.au>
If I traveled to the end of the rainbow
As Dame Fortune did intend,
Murphy would be there to tell me
The pot's at the other end.
		-- Bert Whitney
#!/usr/bin/perl

#
# signature.pl
#
# script that pumps out a funny quip and your email address and full name
# when you read from the (created) fifo.
#
# requires the Proc bundle from 
# www.perl.com/CPAN-local/authors/id/D/DU/DURIST/Proc-ProcessTable-<VER>.tar.gz
#
# James McArthur, 5/12/02
#

use Proc::ProcessTable;
use User::pwent;

chdir; # go home
$FIFO = '.signature';                       # name of where the signatures come from
$ENV{PATH} .= ":/etc:/usr/games:/usr/bin";  # path for the script, change if fortune moves
$TASKNAME   = "signature.pl";               # the name of this task

$USER       = `id -un`;                     # to get the name of the person running the script
$uid        = `id -u`;                      # to get the uid of the person running the script
$HOST       = `hostname -d`;                # to get the domain name of this machine
chomp ($USER);                              # remove whitespaces and newlines
chomp ($HOST);

$DISCLAIMER = "";                           # add your disclaimer here if you need to
$FULLNAME = getpwnam ($USER)->gecos;        # works out your full name from /etc/password
$EMAILADDR = "<$USER\@$HOST>";              # and builds your email address

$process = new Proc::ProcessTable;          # create an interface into the process table
$found_signature_task = "false";


foreach $proc ( @{$process->table})
{
    chomp ($uid);
    if ($uid eq $proc->uid)
    {
	# process is in our uid
	if ($proc->fname eq $TASKNAME)
	{
	    # we have a match to our task
	    # if we are running or zombie, then ignore the task.
	    if ( ($proc->state ne "defunct") &&
		 ($proc->state ne "run"))
	    {
		$found_signature_task = "true";
		print "Found ", $TASKNAME, " [", $proc->pid, "] ", $proc->cmndline, " *", $proc->state, "*\n";
	    }
	    
	}
    }
}

if ($found_signature_task eq "true")
{
    exit (0);
}

while (1) {
    unless (-p $FIFO) {
	unlink $FIFO;
	system('mknod', $FIFO, 'p')
	    && die "can't mknod $FIFO: $!";
    }
    
    # next line blocks until there's a reader
    open (FIFO, "> $FIFO") || die "can't write $FIFO: $!";
    print FIFO "$FULLNAME $EMAILADDR\n",`fortune 25% homer 25% startrek 25% futurama 25% kernelcookies -s`;
    close FIFO;
    sleep 2;    # to avoid dup signals
}

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Fedora General Discussion]     [Red Hat General Discussion]     [Centos]     [Kernel]     [Red Hat Install]     [Red Hat Watch]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux