srs.init 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/sh
  2. #
  3. # srs - a simple, high efficiency and realtime video server
  4. #
  5. # chkconfig: <default runlevel(s)> <start> <stop>
  6. ### BEGIN INIT INFO
  7. # Provides: srs
  8. # Default-Start: 2 3 4 5
  9. # Default-Stop: 0 1 6
  10. # Description: a simple, high efficiency and realtime video server
  11. ### END INIT INFO
  12. # Source function library.
  13. . /etc/rc.d/init.d/functions
  14. exec="/usr/bin/srs"
  15. prog=${exec##*/}
  16. configfile=/etc/srs/srs.conf
  17. [ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
  18. lockfile=/var/lock/subsys/$prog
  19. start() {
  20. echo -n $"Starting $prog: "
  21. daemon --user nobody $exec -c $configfile
  22. retval=$?
  23. echo
  24. [ $retval -eq 0 ] && touch $lockfile
  25. return $retval
  26. }
  27. stop() {
  28. echo -n $"Stopping $prog: "
  29. killproc $exec -TERM
  30. retval=$?
  31. echo
  32. [ $retval -eq 0 ] && rm -f $lockfile
  33. return $retval
  34. }
  35. reload() {
  36. echo -n $"reloading $prog: "
  37. killproc $exec -HUP
  38. retval=$?
  39. echo
  40. [ $retval -eq 0 ] && rm -f $lockfile
  41. return $retval
  42. }
  43. rotate() {
  44. echo -n $"logrotate $prog: "
  45. killproc $exec -USR1
  46. retval=$?
  47. echo
  48. [ $retval -eq 0 ] && rm -f $lockfile
  49. return $retval
  50. }
  51. restart() {
  52. stop
  53. start
  54. }
  55. case "$1" in
  56. start|stop|restart|reload|rotate)
  57. $1
  58. ;;
  59. status)
  60. status $prog
  61. ;;
  62. *)
  63. echo $"Usage: $0 {start|stop|status|restart|reload|rotate}"
  64. exit 2
  65. esac