I have the following systemd unit file in /etc/systemd/system/emacs.service
:
[Unit]
Description=Emacs: the extensible, self-documenting text editor
Documentatin=man:emacs(1) info:Emacs
[Service]
Type=forking
ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval "(progn (setq kill-emacs-hook nil) (kill-emacs))"
Restart=always
Environment=DISPLAY=:%i
TimeoutStartSec=0
[Install]
WantedBy=default.target
I want this to start on boot, so I have entered systemctl enable emacs
However, each time my service reboots, systemctl status emacs
shows:
● emacs.service - Emacs: the extensible, self-documenting text editor
Loaded: loaded (/etc/systemd/system/emacs.service; disabled; vendor preset: enabled)
Active: inactive (dead)
But then entering systemctl start emacs
and checking the status returns:
● emacs.service - Emacs: the extensible, self-documenting text editor
Loaded: loaded (/etc/systemd/system/emacs.service; disabled; vendor preset: enabled)
Active: active (running) since Fri 2016-11-11 23:03:59 UTC; 4s ago
Process: 3151 ExecStart=/usr/bin/emacs --daemon (code=exited, status=0/SUCCESS)
Main PID: 3154 (emacs)
Tasks: 2
Memory: 7.6M
CPU: 53ms
CGroup: /system.slice/emacs.service
└─3154 /usr/bin/emacs --daemon
How can I get this process to successfully start on boot?
After=...
I mentioned. – Alexis Wilke Nov 12 '16 at 01:20WantedBy
was wrong (mult-user
!=multi-user
) – Tarek Fadel May 21 '20 at 18:02journalctl
comment. This is going to be your most powerful debugging tool moving forward. Helped me find the issue with my system, which was totally different. Although,journalctl
will give you a lot of log vomit, so pass the-f
flag forjournalctl -f
– Jeremy Jun 11 '20 at 17:16systemctl list-dependencies
to also be useful for diagnosing "won't start at boot" issues. The system I was working on wasn't actually startingnetwork.target
, so my script wasn't running because its "parent" wasn't part of the boot. – Compholio Oct 05 '21 at 20:32