#!usr/local/bin/perl use strict; # kill all silver stream processes my @processes=`ps -ef | grep ThingIwant | awk \'{ print \$2 }\'`; foreach (@processes) { `kill -9 $_` && print "Process $_ killed!"; } # copy the log file and create a new one `cp /local/webserver/bin/log /local/home/admin/temp_log_copy` && print "performing the copy"; if (-e "/local/home/admin/temp_log_copy" && print "checking the existence of log") { chdir "/local/webserver/bin/"; `rm log` && print "log deleted\n"; `touch log` && print "new log created\n"; `chmod 644 log` && print "log rights changed\n"; `chown root log` && print "changed owner to root\n"; `chgrp other log` && print "changed the group to other\n"; `/bin/sh /local/webserver/bin/startserver.sh` && print "The server is back up"; } if (-e "/local/home/admin/log"`date '+%m%d%y'|sed s/\ /_/g`"_box_50 && print "checking the existence of log") { mv /local/home/admin/temp_log_copy /local/home/admin/log"`date '+%m%d%y'|sed s/\ /_/g`"_box_50a; } else { mv /local/home/admin/temp_log_copy /local/home/admin/log"`date '+%m%d%y'|sed s/\ /_/g`"_box_50; } exit;