#!/usr/bin/perl my $interface = `ifconfig ppp0 2> /dev/null`; exit unless $interface; print "Running global fetchmail...\n"; opendir(DIR,"/home") or die "Could not open /home directory!"; foreach( readdir(DIR) ) { if($_ !~ /\./ && -f "/home/$_/fetchmailrc") { print "Fetch /home/$_/fetchmailrc\n"; system("su \"$_\" -c \"fetchmail -f /home/$_/fetchmailrc\""); } } closedir(DIR);