Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Bummer... :-)

    Random thoughts, which may or may not be helpful:

    • Skip the "grep -v grep" step:

      ps afxww |grep 'm[y]_proc_name'|tail --lines=+2|awk '{print$1}'|xargs kill -HUP

    • Replace the whole line with killall (if available):

      killall -HUP 'm[y]_proc_name'

    • Don't wrap commands in doublequotes :-)


    • I once thought I could get around the "grep", "grep -v", AND the "tail" by doing:
      ps ... | awk 'NR > 1 && /[m]y_proc_name/{print $1}'
      But (maybe depending on your awk) awk blows up when there's more than 99 fields, and there were often 'ps' lines which had very long command lines. So it was good to filter before piping to awk (or maybe just do the whole thing in perl :).
    • Even better, change: ps afxww |grep 'm[y]_proc_name'|tail --lines=+2|awk '{print$1}'|xargs kill -HUP to ps afxww |grep 'm[y]_proc_name'|tail --lines=+2|awk '{print$1}'|less the first time you run it, and make sure those are the results you expected!