SipToSis – Debian init.d script

Here is init script I made to start stsProxy and stsTrunk seems to work fine. If any one has comments or suggestions to it please add or feel free to modify it post and better ways of doing this.

Just save the code to: /etc/init.d/siptosis
then:$ chmod +x /etc/init.d/siptosis
then:$ update-rc.d siptosis defaults

#!/bin/sh
#
### BEGIN INIT INFO
# Provides:       siptosis
# Required-Start: asterisk
# Should-Start:
# Required-Stop:
# Should-Stop:
# Default-Start:  2 3 4 5
# Default-Stop:   0 1 6
# Description:    Start siptosis connector
### END INIT INFO
# Note on runlevels:
# 0 - halt/poweroff                     6 - reboot
# 1 - single user                       2 - multiuser without network exported
# 3 - multiuser w/ network (text mode)  5 - multiuser w/ network and X11 (xdm)
# su -l stsProxyOsUser -c "/home/stsProxyOsUser/stsProxy/stsProxy_Control boot"
case "$1" in
start)
echo -n "Starting stsProxy and stsTrunk "
#Start stsProxy
su -l user -c "nohup /usr/share/stsproxy/stsProxy_Control start >/dev/null &"
#Start stsTrunk
su -l user -c "nohup /usr/share/siptosis/stsTrunk_Control start >/dev/null &"
;;
stop)
#Stop stsProxy
su -l user -c "nohup /usr/share/stsproxy/stsProxy_Control stop >/dev/null &"
#Stop stsTrunk
su -l user -c "nohup /usr/share/siptosis/stsTrunk_Control stop >/dev/null &"
;;
restart)
$0 stop
$0 start
;;
status)
#Status stsProxy
su -l user -c "nohup /usr/share/stsproxy/stsProxy_Control status"

#Status stsTrunk
su -l user -c "nohup /usr/share/siptosis/stsTrunk_Control status"
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0

, , , , , ,

No comments yet.

Leave a Reply

*

Powered by recycled bites and bytes.