hr3lxphr6j / bililive-go

一个直播录制工具
GNU General Public License v3.0
3.88k stars 499 forks source link

systemctl start bililive-go.service 失败,不能启动服务 #516

Closed qslantuzi closed 1 year ago

qslantuzi commented 1 year ago

程序版本

0.7.8

所使用的 config 文件的内容

[Unit] Description=Live Stream Saver Wants=network-online.target After=network-online.target

[Service] Type=simple ExecStart=/www/wwwroot/biligo/bililive-linux-amd64 -c /www/wwwroot/biligo/config.yml Restart=on-failure

[Install] WantedBy=multi-user.target

程序 log

[root@localhost ~]# systemctl start bililive-go.service [root@localhost ~]# systemctl status bililive-go.service ● bililive-go.service - Live Stream Saver Loaded: loaded (/usr/lib/systemd/system/bililive-go.service; enabled; vendor preset: disabled) Active: failed (Result: start-limit) since 一 2023-08-07 11:42:54 CST; 6s ago Process: 41865 ExecStart=/www/wwwroot/biligo/bililive-linux-amd64 -c /www/wwwroot/biligo/config.yml (code=exited, status=1/FAILURE) Main PID: 41865 (code=exited, status=1/FAILURE)

8月 07 11:42:54 localhost.localdomain systemd[1]: bililive-go.service: main process exited, code=exited,...LURE 8月 07 11:42:54 localhost.localdomain systemd[1]: Unit bililive-go.service entered failed state. 8月 07 11:42:54 localhost.localdomain systemd[1]: bililive-go.service failed. 8月 07 11:42:54 localhost.localdomain systemd[1]: bililive-go.service holdoff time over, scheduling restart. 8月 07 11:42:54 localhost.localdomain systemd[1]: Stopped Live Stream Saver. 8月 07 11:42:54 localhost.localdomain systemd[1]: start request repeated too quickly for bililive-go.service 8月 07 11:42:54 localhost.localdomain systemd[1]: Failed to start Live Stream Saver. 8月 07 11:42:54 localhost.localdomain systemd[1]: Unit bililive-go.service entered failed state. 8月 07 11:42:54 localhost.localdomain systemd[1]: bililive-go.service failed. Hint: Some lines were ellipsized, use -l to show in full.

自由描述

在/www/wwwroot/biligo目录下 执行 ./bililive-linux-amd64 -c config.yml 可以录视频

kira1928 commented 1 year ago

https://github.com/hr3lxphr6j/bililive-go/tree/master/contrib/systemd 这个对你的问题有帮助吗?

qslantuzi commented 1 year ago

不行,还是不能启动

kira1928 commented 1 year ago

@liwufan 大佬能帮忙看看吗?

liwufan commented 1 year ago

status 日志都是11:42:54 同一秒内信息有点少,能用journalctl -u bililive-go.service 看看刚开始的报错吗? 还有最新是0.7.15 你用的是年初的版本

qslantuzi commented 1 year ago

最新的版本也会抱错:FFmpeg binary not found, Please Check. [root@localhost ~]# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/ffmpeg/bin:/root/bin [root@localhost ~]# ffmpeg -version ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44) configuration: --prefix=/usr/local/ffmpeg --enable-openssl --enable-shared libavutil 58. 2.100 / 58. 2.100 libavcodec 60. 3.100 / 60. 3.100 libavformat 60. 3.100 / 60. 3.100 libavdevice 60. 1.100 / 60. 1.100 libavfilter 9. 3.100 / 9. 3.100 libswscale 7. 1.100 / 7. 1.100 libswresample 4. 10.100 / 4. 10.100 [root@localhost ~]# journalctl -u bililive-go.service -- Logs begin at 二 2023-08-08 17:24:11 CST, end at 二 2023-08-08 10:43:46 CST. -- 8月 08 09:26:13 localhost.localdomain systemd[1]: Started Live Stream Saver. 8月 08 09:26:13 localhost.localdomain bililive-go[4585]: FFmpeg binary not found, Please Check. 8月 08 09:26:13 localhost.localdomain systemd[1]: bililive-go.service: main process exited, code=exited, status= 8月 08 09:26:13 localhost.localdomain systemd[1]: Unit bililive-go.service entered failed state. 8月 08 09:26:13 localhost.localdomain systemd[1]: bililive-go.service failed. 8月 08 09:30:53 localhost.localdomain systemd[1]: Started Live Stream Saver.

murphysking commented 1 year ago

ffmpeg没装,手动安装下,或者检查下ffmpeg可执行文件路径是否包含在环境变量内

qslantuzi commented 1 year ago

[root@localhost ~]# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/ffmpeg/bin:/root/bin [root@localhost ~]# ffmpeg -version ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-44) configuration: --prefix=/usr/local/ffmpeg --enable-openssl --enable-shared libavutil 58. 2.100 / 58. 2.100 libavcodec 60. 3.100 / 60. 3.100 libavformat 60. 3.100 / 60. 3.100 libavdevice 60. 1.100 / 60. 1.100 libavfilter 9. 3.100 / 9. 3.100 libswscale 7. 1.100 / 7. 1.100 libswresample 4. 10.100 / 4. 10.100

安装了ffmpeg,可以录制视频,但是不能作为服务启动

liwufan commented 1 year ago

ffmpeg没装,手动安装下,或者检查下ffmpeg可执行文件路径是否包含在环境变量内

差不多是这情况,有两种解法。

  1. systemd 有自己的环境变量用systemctl show-environment 看而不是echo $path,然后再在unit里面设置Environment=
  2. 把 which ffmpeg 的绝对路径填到config.yml 的ffmpeg_path: 里

挑一个方便的

qslantuzi commented 1 year ago

多谢,现在可以了 [root@localhost ~]# which ffmpeg /usr/local/ffmpeg/bin/ffmpeg [root@localhost ~]# systemctl start bililive-go.service [root@localhost ~]# systemctl status bililive-go.service ● bililive-go.service - Live Stream Saver Loaded: loaded (/etc/systemd/system/bililive-go.service; enabled; vendor preset: disabled) Active: active (running) since 二 2023-08-08 15:49:03 CST; 6s ago Main PID: 16565 (bililive-go) CGroup: /system.slice/bililive-go.service └─16565 /www/wwwroot/biligo/bililive-go -c /www/wwwroot/biligo/config.yml

8月 08 15:49:03 localhost.localdomain systemd[1]: Started Live Stream Saver. 8月 08 15:49:03 localhost.localdomain bililive-go[16565]: time="2023-08-08 15:49:03" level=info msg="Bili...rt" 8月 08 15:49:04 localhost.localdomain bililive-go[16565]: time="2023-08-08 15:49:04" level=info msg="Serv...80" Hint: Some lines were ellipsized, use -l to show in full. [root@localhost ~]# ps -ef|grep bililive-go root 16565 1 0 15:49 ? 00:00:00 /www/wwwroot/biligo/bililive-go -c /www/wwwroot/biligo/config.yml root 16589 16088 0 15:49 pts/0 00:00:00 grep --color=auto bililive-go [root@localhost ~]# systemctl stop bililive-go [root@localhost ~]# ps -ef|grep bililive-go root 16640 16088 0 15:50 pts/0 00:00:00 grep --color=auto bililive-go

qslantuzi commented 1 year ago

多谢,现在可以了