I KNOW this is the wrong way to do it and I am getting errors on the the last if statement. Can someone help me convert the shell script to perl code? The process ONLY dies with kill 9. Randal said to use +9.

#!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;

Ergowolf
Does code make a sound if no one is there to type it?

In reply to convert shell to perl by ergowolf

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.