
1 l9rw 2017-06-22 10:12:14 +08:00 |
2 Baymaxbowen 2017-06-22 10:37:26 +08:00 @l9rw 求网址 |
4 0asis 2017-06-22 11:06:35 +08:00 via iPhone 有个叫 init.d 的文件夹,具体百度 |
6 gzwawj OP @0asis 怎么让“ ffmpeg -i rtsp://admin:******@192.168.16.233/h264/ch1/main/av_stream -vcodec copy -acodec aac -ar 44100 -strict -2 -ac 1 -f flv -s 1280x720 -q 10 -f flv rtmp://192.168.16.112:1935/live/hall_2 >/dev/null 2>&1 & ”这条命令加到开机自动运行 |
8 knightdf 2017-06-22 11:37:42 +08:00 加到 /etc/rc.local |
10 thecon 2017-06-22 11:41:59 +08:00 早期版本很简单 , 把脚本放 /etc/rc.local 里就行了 16.04 以后就比较麻烦了, 得自己添加个 systemctl 服务 |
12 thecon 2017-06-22 11:50:49 +08:00 @gzwawj vi /etc/systemd/system/尼想要的服务名.service 加入如下内容: [Unit] Description=尼的脚本路径 Compatibility COnditionPathExists=尼的脚本路径 [Service] Type=forking ExecStart=尼的脚本路径 start TimeoutSec=0 StandardOutput=tty RemainAfterExit=yes SysVStartPriority=99 [Install] WantedBy=multi-user.target 脚本要有可执行属性, 路径要绝对路径 然后取保脚本正确执行后最后的代码是: exit 0 激活服务: sudo systemctl enable 尼想要的服务名 启动服务器和检查状态: sudo systemctl start 尼想要的服务名.service sudo systemctl status 尼想要的服务名.service |
15 lxml 2017-06-22 16:43:06 +08:00 @thecon #14 感谢,我搜教程老出来说添加 rc.local,我心说找了半天我 17.04 文件夹都是 rc0.local,果然又又又又被改版坑了。 |
16 ahu 2017-06-22 21:59:09 +08:00 一楼这个简直了,,,, |
17 ahu 2017-06-22 22:02:41 +08:00 |
18 zjp 2017-06-22 23:16:20 +08:00 via Android 阮一峰的博客有 systemd 的介绍。顺带吐个槽:doge: 就在刚刚,systemctl enable xxx 一直不成功,排查半小时发现脚本打漏仨字母… |
20 b1eberg0n 2017-06-23 00:52:41 +08:00 via iPhone supervisor |
21 loading 2017-06-23 06:55:21 +08:00 via Android ubuntu wiki 挂了? |