将turnserver设定成开机启动
1.创建一个文件,在目录/etc/init/下面
#sudo vim /etc/init/turnserver.conf
2.添加如下内容
description "turn server"
author "Haijunzhu"
# Saves log to /var/log/upstart/easyrtc.log
console log
# Starts only after drives are mounted.
start on started mountall
stop on shutdown
# Automatically Respawn. But fail permanently if it respawns 10 times in 5 seconds:
respawn
respawn limit 10 5
script
# Note: To run as a non root user, use exec sudo -u USERNAME node /var/nodes/easyrtc/server.js
exec start-stop-daemon --start --quiet --exec /usr/local/bin/turnserver -- -L 115.28.201.200
end script
~
~
~
~
3. 保存
4.重启
5.查看重启之后是否启动成功
#sudo netstat -ano|grep 3478
root@AY1406091211019989a7Z:~# netstat -ano|grep 3478
tcp 0 0 115.28.201.200:3478 0.0.0.0:* LISTEN off (0.00/0/0)
tcp 0 0 10.144.39.153:3478 0.0.0.0:* LISTEN off (0.00/0/0)
tcp 0 0 127.0.0.1:3478 0.0.0.0:* LISTEN off (0.00/0/0)
udp 0 0 115.28.201.200:3478 0.0.0.0:* off (0.00/0/0)
udp 0 0 10.144.39.153:3478 0.0.0.0:* off (0.00/0/0)
udp 0 0 127.0.0.1:3478 0.0.0.0:* off (0.00/0/0)
note: 3478是turn 服务的默认端口号,当然,我们可以指定,关于turnserver详细的设定,后续的文章中会出现