$ touch /etc/systemd/system/emacs.service
$ chmod 664 /etc/systemd/system/emacs.service
/etc/systemd/system/emacs.service
[Unit]
Description=Emacs: the extensible, self-documenting text editor
[Service]
Type=forking
ExecStart=/usr/bin/emacs --daemon
ExecStop=/usr/bin/emacsclient --eval "(kill-emacs)"
Environment=SSH_AUTH_SOCK=%t/keyring/ssh
Restart=always
[Install]
WantedBy=default.target
$ systemctl daemon-reload
$ systemctl start emacs.service