ergowolf has asked for the wisdom of the Perl Monks concerning the following question:
#!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 existe +nce 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;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: convert shell to perl
by ncw (Friar) on Aug 31, 2000 at 18:46 UTC | |
|
Re: convert shell to perl
by eak (Monk) on Sep 01, 2000 at 07:55 UTC | |
|
Re: convert shell to perl
by fundflow (Chaplain) on Aug 31, 2000 at 18:38 UTC | |
|
Re: convert shell to perl
by b (Beadle) on Sep 01, 2000 at 18:15 UTC |