rc.svxlink 1011 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh
  2. # Start/stop/restart svxlink.
  3. # Start svxlink:
  4. svxlink_start() {
  5. CMDLINE="/usr/bin/svxlink --daemon --runasuser=svxlink --pidfile=/var/run/svxlink.pid --logfile=/var/log/svxlink"
  6. # CMDLINE="/usr/bin/svxlink --daemon --runasuser=svxlink --pidfile=/var/run/svxlink.pid"
  7. echo -n "Starting SvxLink: $CMDLINE"
  8. $CMDLINE
  9. echo
  10. }
  11. # Stop svxlink:
  12. svxlink_stop() {
  13. echo -n "Stopping SvxLink..."
  14. if [ -r /var/run/svxlink.pid ]; then
  15. kill $(cat /var/run/svxlink.pid)
  16. rm -f /var/run/svxlink.pid
  17. else
  18. killall -q svxlink
  19. fi
  20. echo
  21. }
  22. # Restart svxlink:
  23. svxlink_restart() {
  24. svxlink_stop
  25. sleep 1
  26. svxlink_start
  27. }
  28. # Check if svxlink is running:
  29. svxlink_status() {
  30. if [ -e /var/run/svxlink.pid ]; then
  31. echo "SvxLink is running."
  32. else
  33. echo "SvxLink is stopped."
  34. exit 1
  35. fi
  36. }
  37. case "$1" in
  38. 'start')
  39. svxlink_start
  40. ;;
  41. 'stop')
  42. svxlink_stop
  43. ;;
  44. 'restart')
  45. svxlink_restart
  46. ;;
  47. 'status')
  48. svxlink_status
  49. ;;
  50. *)
  51. echo "usage $0 start|stop|restart|status"
  52. esac