12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- #!/bin/sh
- #
- # PROVIDE: goprogram
- # REQUIRE: networking
- # KEYWORD:
- . /etc/rc.subr
- name="rtmp"
- rcvar="rtmp_enable"
- workingdir="/root/src/rtsp-simple-server/"
- command="/root/src/rtsp-simple-server/rtsp-simple-server"
- goprogram_user="root"
- pidfile="/var/run/${name}.pid"
- start_cmd="rtmp_start"
- stop_cmd="rtmp_stop"
- status_cmd="rtmp_status"
- rtmp_start() {
- cd $workingdir
- /usr/sbin/daemon -P ${pidfile} -r -f -u $goprogram_user $command
- }
- rtmp_stop() {
- if [ -e "${pidfile}" ]; then
- kill -s TERM `cat ${pidfile}`
- else
- echo "${name} is not running"
- fi
- }
- rtmp_status() {
- if [ -e "${pidfile}" ]; then
- echo "${name} is running as pid `cat ${pidfile}`"
- else
- echo "${name} is not running"
- fi
- }
- load_rc_config $name
- : ${rtmp_enable:=no}
- run_rc_command "$1"
|