#!/usr/bin/perl -w # Perform some action on your exit from the last tty you are logged on. # I use it to close fetchmail from .bash_logout (I start it from # .bash_profile) # Sorry for any mistakes - it's my first post... open(MY_IN, 'users|') or die "No possibility to read from the stream.\n"; $line = ; close MY_IN; chomp $line; @sus = split / /, $line; foreach (@sus) { if ($_ eq "pfm") { $num++; } } if ($num eq 1) { exec "fetchmail --quit"; }