Search code examples
grepfreebsdkillpidnohup

Script to HUP parent and child process


I need a shell script to send a HUP to the parent and child processes.

I am using freeBSD with tcsh? #/bin/sh

Somehow, I need to pipe the PID output from pgrep to kill -HUP in a loop in a shell script.

Ultimately I want to run this script as a cron job.

I just don't have the skills yet.

Thanks - Brad


Solution

  • (This isn't a complete answer, but I can't make comments without at least 50 reputation apparently).

    First of all, /bin/sh on FreeBSD is a Boune-compatible shell, not tcsh (which is /bin/tcsh). A start would be something like the following:

    #!/bin/sh
    for pid in $(pgrep <process name>); do kill -HUP $pid; done
    

    Without more details, I can't really say much more.