#!/usr/bin/perl use Mail::Sendmail; my $dirWatch = "/home/lifesol1/public_html/admin/feeds"; my $watchOwnerChk = `ls -ld /home/lifesol1/public_html/admin/feeds | awk '{print $4}' |grep nobody`; if (!$watchOwnerChk) { print "Group nobody is not set on $dirWatch \n"; system("chown -R lifesol1.nobody $dirWatch"); system("chmod -R 775 $dirWatch"); %mail = ( To => 'Admin ', From => 'root ', Cc => 'LW ', Subject => 'Group nobody is missing!', 'X-Mailer' => "Mail::Sendmail version $Mail::Sendmail::VERSION", ); $mail{'X-custom'} = 'Mailed by quark.hosting-strikehawk.com'; $mail{'mESSaGE : '} = "Alert: /home/lifesol1/public_html/admin/feeds did not have group set to nobody! Auto corrected, I set it to lifesol1.nobody and 0775 recursively. Please note date/time of this message for tracking."; if (sendmail %mail) { print "Mail sent OK.\n" } else { print "Error sending mail: $Mail::Sendmail::error \n" } print "\n\$Mail::Sendmail::log says:\n", $Mail::Sendmail::log , "\n"; } else { print "Group nobody is set on $dirWatch \n"; }