Guest User

Untitled

a guest
Jan 19th, 2018
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.97 KB | None | 0 0
  1. #!/bin/sh
  2. # Start/stop the Kannel boxes: One bearer box and one WAP box.
  3. # This is the default init.d script for Kannel. Its configuration is
  4. # appropriate for a small site running Kannel on one machine.
  5. # Make sure that the Kannel binaries can be found in $BOXPATH or somewhere
  6. # else along $PATH. run_kannel_box has to be in $BOXPATH.
  7. ### BEGIN INIT INFO
  8. # Provides: kannel
  9. # Required-Start: $syslog
  10. # Required-Stop: $syslog
  11. # Should-Start: $local_fs $network
  12. # Should-Stop: $local_fs $network
  13. # Default-Start: 2 3 4 5
  14. # Default-Stop: 0 1 6
  15. # Short-Description: SMS and WAP gateway
  16. # Description: Kannel is a gateway for connecting WAP phones to the
  17. # Internet. It also works as an SMS gateway.
  18. ### END INIT INFO
  19. . /lib/lsb/init-functions
  20. BOXPATH=/usr/local/sbin/
  21. PIDFILES=/var/run/kannel
  22. CONF=/etc/kannel/kannel.conf
  23. PATH=$BOXPATH:$PATH
  24. # On Debian, the most likely reason for the bearerbox not being available
  25. # is that the package is in the "removed" or "unconfigured" state, and the
  26. # init.d script is still around because it's a conffile. This is normal,
  27. # so don't generate any output.
  28. test -x $BOXPATH/bearerbox || exit 0
  29. test -r /etc/default/kannel && . /etc/default/kannel
  30. if [ ! -d $PIDFILES ]
  31. then
  32. mkdir $PIDFILES
  33. chown kannel:root $PIDFILES
  34. fi
  35. case "$1" in
  36. start)
  37. log_daemon_msg "Starting WAP gateway"
  38. log_progress_msg "bearerbox"
  39. start-stop-daemon --start --quiet \
  40. --pidfile $PIDFILES/kannel_bearerbox.pid \
  41. --chuid kannel \
  42. --exec $BOXPATH/run_kannel_box \
  43. -- \
  44. --pidfile $PIDFILES/kannel_bearerbox.pid \
  45. --no-extra-args \
  46. $BOXPATH/bearerbox -v 4 -- $CONF
  47. sleep 1 # Wait for bearerbox
  48. test ! -z $START_WAPBOX && (
  49. log_progress_msg "wapbox"
  50. start-stop-daemon --start --quiet \
  51. --pidfile $PIDFILES/kannel_wapbox.pid \
  52. --chuid kannel \
  53. --exec $BOXPATH/run_kannel_box \
  54. -- \
  55. --pidfile $PIDFILES/kannel_wapbox.pid \
  56. --no-extra-args \
  57. $BOXPATH/wapbox -v 4 -- $CONF
  58. )
  59. test ! -z $START_SMSBOX && (
  60. log_progress_msg "smsbox"
  61. start-stop-daemon --start --quiet \
  62. --pidfile $PIDFILES/kannel_smsbox.pid \
  63. --chuid kannel \
  64. --exec $BOXPATH/run_kannel_box \
  65. -- \
  66. --pidfile $PIDFILES/kannel_smsbox.pid \
  67. --no-extra-args \
  68. $BOXPATH/smsbox -v 0 -- $CONF
  69. # $BOXPATH/smsbox -- $CONF
  70. )
  71. log_end_msg 0
  72. ;;
  73. stop)
  74. log_daemon_msg "Stopping WAP gateway"
  75. test ! -z $START_SMSBOX && (
  76. log_progress_msg "smsbox"
  77. start-stop-daemon --stop --retry 5 --quiet \
  78. --pidfile $PIDFILES/kannel_smsbox.pid \
  79. --exec $BOXPATH/run_kannel_box
  80. )
  81. test ! -z $START_WAPBOX && (
  82. log_progress_msg "wapbox"
  83. start-stop-daemon --stop --retry 5 --quiet \
  84. --pidfile $PIDFILES/kannel_wapbox.pid \
  85. --exec $BOXPATH/run_kannel_box
  86. )
  87. log_progress_msg "bearerbox"
  88. start-stop-daemon --stop --retry 5 --quiet \
  89. --pidfile $PIDFILES/kannel_bearerbox.pid \
  90. --exec $BOXPATH/run_kannel_box
  91. log_end_msg 0
  92. ;;
  93. reload)
  94. # We don't have support for this yet.
  95. exit 1
  96. ;;
  97. restart|force-reload)
  98. $0 stop
  99. sleep 1
  100. $0 start
  101. ;;
  102. *)
  103. echo "Usage: $0 {start|stop|restart|force-reload}"
  104. exit 1
  105. esac
  106. exit 0
Add Comment
Please, Sign In to add comment