#!/usr/local/bin/perl -w sub on { open(FORWARD, ">/home/$username/.forward") || die ("Unable to open /home/$username/.forward"); #.forward must look like #\username, "|/usr/bin/vacation username" $set_fwd="\\$username, \"|/usr/bin/vacation $username\""; print FORWARD $set_fwd; close(FORWARD); open(VMESSAGE, ">/home/$username/.vacation.msg") || die ("Unable to open /home/$username/.vacation.msg"); print VMESSAGE $message; print VMESSAGE "\n"; close(VMESSAGE); open(VACATIONDIR, ">/home/$username/.vacation.dir") || die ("Unable to open /home/$username/.vacation.dir"); close(VACATIONDIR); open(VACATIONPAG, ">/home/$username/.vacation.pag") || die ("Unable to open /home/$username/.vacation.pag"); close(VACATIONPAG); `chmod 644 /home/$username/.forward /home/$username/.vacation.msg /home/$username/.vacation.pag /home/$username/.vacation.dir`; `chown $username /home/$username/.forward /home/$username/.vacation.msg /home/$username/.vacation.pag /home/$username/.vacation.dir`; } sub off { `rm -f /home/$username/.vacation.msg`; `rm -f /home/$username/.vacation.pag`; `rm -f /home/$username/.vacation.dir`; `rm -f /home/$username/.forward`; } if (($#ARGV > 1) ||(($#ARGV == 1) && ($ARGV[1] eq "off"))) { $username=$ARGV[0]; $on_off=$ARGV[1]; if($on_off eq "on") { $message = join (" ",@ARGV); $message =~ s/$username//; $message =~ s/$on_off//; &on(); print "
$username\'s vacation message has been \n"; print " activated.

\n"; print "
\n"; print "
\n"; print "

Please E-Mail $username\@whereiwork.com\n"; print " to test this message.
If you do not recieve an automatic response with your\n"; print " vacation message please resubmit this form and try again.
\n"; } elsif($on_off eq "off") { &off(); print "
$username\'s vacation message has been \n"; print " deactivated.

\n"; print "
\n"; print "
\n"; print "

Please E-Mail $username\@whereiwork.com\n"; print " to test this message.
If you recieve an automatic response with your\n"; print " vacation message please resubmit this form and try again.
\n"; } } else { print "Not all necessary values have been given.\n"; }