Merge remote-tracking branch 'kc/new/enh/bug_5917' into kcmaster
[koha.git] / C4 / SIP / sip_shutdown.sh
1 #!/bin/bash
2
3 . $HOME/.bash_profile
4
5 # this is brittle: the primary server must have the lowest PPID
6 # this is brittle: ps behavior is very platform-specific, only tested on Debian Etch
7
8 target="SIPServer";
9 PROCPID=$(ps x -o pid,ppid,args --sort ppid | grep "$target" | grep -v grep | head -1 | awk '{print $1}');
10
11 if [ ! $PROCPID ] ; then
12     echo "No processes found for $target";
13     exit;
14 fi
15
16 echo "SIP Processes for this user ($USER):";
17 ps x -o pid,ppid,args --sort ppid | grep "$target" | grep -v grep ;
18 echo "Killing process #$PROCPID";
19 kill $PROCPID;