Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Well, its the usual case of 'this script isnt working and im sure its some silly little error that i just cant notice cause i wrote the script, so i need someone else to look at it and see if they notice anything' type of problem. the script is supposed to be run in a cron job to check the directory one step above itself, see if there are any newly uploaded files, and if so, email someone and alert them. thanks in advance, and sorry to take up yer time :)
#!/usr/bin/perl # Upload Alert Script opendir(DIR,'../'); @dir = readdir(DIR); closedir(DIR); $files = 0; foreach $i (0..$#dir) { if( ($dir[$i] ne "index.html") && ($dir[$i] ne ".") && ($dir[$i] ne "..") && ($dir[$i] ne "cgi-bin") ) {$files = 1} } if($files == 1) { open(MAIL,"|/usr/sbin/sendmail -t"); print MAIL <<"EOC"; To: admin\@thiswebsite.com From: notify\@thiswebsite.com Reply-to: admin\@thiswebsite.com Subject: !!! Newly Uploaded Files !!! New files uploaded. . EOC close(MAIL); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: STUPID STUPID STUPID old me.
by grantm (Parson) on Oct 28, 2002 at 09:17 UTC | |
by BrentDax (Hermit) on Oct 30, 2002 at 03:10 UTC | |
Re: STUPID STUPID STUPID old me.
by Chady (Priest) on Oct 28, 2002 at 08:09 UTC | |
Re: STUPID STUPID STUPID old me.
by George_Sherston (Vicar) on Oct 28, 2002 at 11:57 UTC | |
Re: STUPID STUPID STUPID old me.
by bart (Canon) on Oct 28, 2002 at 12:27 UTC | |
Re: STUPID STUPID STUPID old me.
by Louis_Wu (Chaplain) on Oct 28, 2002 at 07:43 UTC | |
by Anonymous Monk on Oct 28, 2002 at 07:49 UTC | |
by Ananda (Pilgrim) on Oct 28, 2002 at 08:36 UTC | |
by Louis_Wu (Chaplain) on Oct 28, 2002 at 08:41 UTC |
Back to
Seekers of Perl Wisdom