rtmpserver 880 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/sh
  2. #
  3. # PROVIDE: goprogram
  4. # REQUIRE: networking
  5. # KEYWORD:
  6. . /etc/rc.subr
  7. name="rtmp"
  8. rcvar="rtmp_enable"
  9. workingdir="/root/src/rtsp-simple-server/"
  10. command="/root/src/rtsp-simple-server/rtsp-simple-server"
  11. goprogram_user="root"
  12. pidfile="/var/run/${name}.pid"
  13. start_cmd="rtmp_start"
  14. stop_cmd="rtmp_stop"
  15. status_cmd="rtmp_status"
  16. rtmp_start() {
  17. cd $workingdir
  18. /usr/sbin/daemon -P ${pidfile} -r -f -u $goprogram_user $command
  19. }
  20. rtmp_stop() {
  21. if [ -e "${pidfile}" ]; then
  22. kill -s TERM `cat ${pidfile}`
  23. else
  24. echo "${name} is not running"
  25. fi
  26. }
  27. rtmp_status() {
  28. if [ -e "${pidfile}" ]; then
  29. echo "${name} is running as pid `cat ${pidfile}`"
  30. else
  31. echo "${name} is not running"
  32. fi
  33. }
  34. load_rc_config $name
  35. : ${rtmp_enable:=no}
  36. run_rc_command "$1"