Browse Source

Bug 12169: Use pid file in sipserver shutdown

Change sample SIPConfig to request server writes a pid file

Use this pid in shutdown rather than the current open to error
method.

Have also added to the Config parameters to ensure that the sipserver
runs as the correct user and sets its own session id. These are always
useful but makes it easier for users to run up the sipserver as root at
boot time similarly to apache, mysql etc

Added to the sample config where to locate other server parameter
documentation.

Removed from the sample config the unedifying, unwanted and
purely historical http example

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.11/bug30761
Colin Campbell 9 years ago
committed by Jonathan Druart
parent
commit
d94d81fdf7
  1. 9
      etc/SIPconfig.xml
  2. 19
      misc/bin/sip_shutdown.sh

9
etc/SIPconfig.xml

@ -5,6 +5,10 @@
<!--
Set Net::Server::PreFork runtime parameters
syslog_ident will identify SIP2 Koha server entries in syslog
See documentation for Net::Server
user and group select what user the service should run as
if started as root (e.g. in server startup ) the server will switch to
this user after binding to the socket it is listening on
For OpenSolaris, add: syslog_logsock=stream
-->
<server-params
@ -13,6 +17,10 @@
log_file='Sys::Syslog'
syslog_ident='koha_sip'
syslog_facility='local6'
setsid="1"
user='koha'
group='koha'
pid_file='/var/run/sipserver.pid'
/>
<listeners>
@ -121,4 +129,3 @@ in our case "ILS".
<AllFinesNeedOverride>0</AllFinesNeedOverride>
</syspref_overrides>
</acsconfig>

19
misc/bin/sip_shutdown.sh

@ -1,19 +1,10 @@
#!/bin/bash
. $HOME/.bash_profile
#Terminates the session leader Sipserver which should terminate the children
# The pidfile name is specified as a server parameter in the configuration
# file
# this is brittle: the primary server must have the lowest PPID
# this is brittle: ps behavior is very platform-specific, only tested on Debian Etch
PID_FILE=/var/run/sipserver.pid
target="SIPServer";
PROCPID=$(ps x -o pid,ppid,args --sort ppid | grep "$target" | grep -v grep | head -1 | awk '{print $1}');
kill `cat $PID_FILE`
if [ ! $PROCPID ] ; then
echo "No processes found for $target";
exit;
fi
echo "SIP Processes for this user ($USER):";
ps x -o pid,ppid,args --sort ppid | grep "$target" | grep -v grep ;
echo "Killing process #$PROCPID";
kill $PROCPID;

Loading…
Cancel
Save