The ExecStart doesn't start a shell and it doesn't support globbing (i.e. *.go). The best way to do this would be to create a shell scriptand change your service to this ...Code:
sudo tee /usr/local/bin/webrtc.sh#!/usr/bin/bashGO111MODULE=on/usr/bin/go run *.goEOFsudo chmod +x /usr/local/bin/webrtc.sh
Code:
sudo tee /etc/systemd/system/webrtc.service >/dev/null << EOF[Unit]Wants=network.target[Service]ExecStart=/usr/local/bin/webrtc.shWorkingDirectory=/home/nickserver/RTSPtoWebRTC[Install]WantedBy=multi-user.targetEOF
When I do this, I get this output:
Code:
× webrtc.service Loaded: loaded (/etc/systemd/system/webrtc.service; enabled; preset: enabled) Active: failed (Result: exit-code) since Sun 2024-01-28 14:45:41 ACDT; 6s ago Duration: 12ms Process: 14302 ExecStart=/usr/local/bin/webrtc.sh (code=exited, status=127) Main PID: 14302 (code=exited, status=127) CPU: 14mssystemd[1]: Started webrtc.service.webrtc.sh[14305]: go: module cache not found: neither GOMODCACHE nor GOPATH is setwebrtc.sh[14312]: /usr/local/bin/webrtc.sh: line 4: EOF: command not foundsystemd[1]: webrtc.service: Main process exited, code=exited, status=127/n/asystemd[1]: webrtc.service: Failed with result 'exit-code'.
Code:
systemd[1]: webrtc.service: Failed with result 'exit-code'.systemd[1]: Started webrtc.service - Start RTSPtoWebRTC.webrtc.sh[10583]: go: module cache not found: neither GOMODCACHE nor GOPATH is setsystemd[1]: webrtc.service: Main process exited, code=exited, status=1/FAILUREsystemd[1]: webrtc.service: Failed with result 'exit-code'.systemd[1]: Started webrtc.service.webrtc.sh[14305]: go: module cache not found: neither GOMODCACHE nor GOPATH is setwebrtc.sh[14312]: /usr/local/bin/webrtc.sh: line 4: EOF: command not foundsystemd[1]: webrtc.service: Main process exited, code=exited, status=127/n/asystemd[1]: webrtc.service: Failed with result 'exit-code'.
Code:
stat *.go: no such file or directory./webrtc.sh: line 4: EOF: command not found
Code:
stat *.go: no such file or directory
Code:
#!/usr/bin/bashGO111MODULE=oncd /home/nickserver/RTSPtoWebRTCgo run *.go
Thanks for your help!
Statistics: Posted by Yahoo Kazooie — Sun Jan 28, 2024 4:25 am