Interview Prep/Linux/systemd services and journald

`systemctl start myapp` returns immediately with success, but the app isn't running a second later and `status` shows `inactive (dead)` with `code=exited, status=0/SUCCESS`.

IntermediateTroubleshootingsystemd services and journald
Answer

Likely causes → ExecStart runs a script that launches the app in the background and exits (& or nohup), so systemd sees the main process end and cleans up the cgroup.

Diagnose →

systemctl cat myapp
journalctl -u myapp -b

Fix → Make the script exec the app in the foreground (exec /opt/myapp/bin/server), and keep Type=simple or Type=exec.

Prevent → Avoid wrapper scripts that daemonise; let systemd supervise directly.

All Linux questions Roadmap: Linux

More on systemd services and journald