I have a golang API that needs to run 24/7 for a nginx proxy backstream.
I have a script..
#!/usr/bin/bash cd /root/api && go run . That runs fine manually.
But /etc/systemd/system/api.service fails to start
.service:
[Unit] Description=A go-lang API for the www frontend [Service] Type = simple ExecStart=/root/api.sh systemctl status reports
× api.service - A go-lang API for the www frontend Loaded: loaded (/etc/systemd/system/api.service; static) Active: failed (Result: exit-code) since Thu 2024-11-21 18:55:03 UTC; 2min 17s ago Duration: 118ms Invocation: e6e602afee2b4bf6b2d623c15fcbb65e Process: 343565 ExecStart=/root/api.sh (code=exited, status=1/FAILURE) Main PID: 343565 (code=exited, status=1/FAILURE) Mem peak: 2.8M CPU: 50ms
Afterspecified in[Unit]- perhaps your systemd unit is starting too early