wiki:systemd_user_service
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
wiki:systemd_user_service [2021/08/19 11:35] – Add info box antisa | wiki:systemd_user_service [2023/04/20 21:40] – [systemd --user does not work: 'Failed to connect to bus'] add reboot info antisa | ||
---|---|---|---|
Line 5: | Line 5: | ||
Example: | Example: | ||
- | < | + | < |
[Unit] | [Unit] | ||
Description=my npm app | Description=my npm app | ||
Line 13: | Line 13: | ||
ExecStart=/ | ExecStart=/ | ||
WorkingDirectory=/ | WorkingDirectory=/ | ||
+ | Restart=on-failure | ||
[Install] | [Install] | ||
Line 18: | Line 19: | ||
</ | </ | ||
- | 2. From root enable lingering so that it persists over reboots and logouts | + | 2. Enable service |
+ | systemctl --user enable mynpmapp.service | ||
+ | |||
+ | 3. From root enable lingering so that it persists over reboots and logouts | ||
loginctl enable-linger username | loginctl enable-linger username | ||
- | 3. Use '' | + | 4. Use '' |
===== TROUBLESHOOTING ===== | ===== TROUBLESHOOTING ===== | ||
Line 38: | Line 42: | ||
export DBUS_SESSION_BUS_ADDRESS=" | export DBUS_SESSION_BUS_ADDRESS=" | ||
- | then logout and login again. | + | then logout and login again. If its still not working and you get na error |
+ | |||
+ | Failed to connect to bus: No such file or directory | ||
+ | |||
+ | try rebooting the server. | ||
Line 50: | Line 58: | ||
* https:// | * https:// | ||
* https:// | * https:// | ||
+ | * https:// | ||
wiki/systemd_user_service.txt · Last modified: 2023/04/20 22:15 by antisa