Configure
Create file X.service[Unit]
Description=X service
After=auditd.service systemd-user-sessions.service time-sync.target
[Service]
User=gregory
TimeoutStartSec=0
Type=simple
KillMode=process
WorkingDirectory=/tmp/
ExecStart=/home/gregory/bin/X
Restart=always
RestartSec=2
LimitNOFILE=5555
[Install]
WantedBy=multi-user.target
Install
cp X.service /lib/systemd/system/
chmod 0664 /lib/systemd/system/X.service
systemctl daemon-reload
systemctl enable X.service
systemctl start X
systemctl status X
Control
Allow yourself to control servicesudo usermod -a -G sudo gregory
Upload and reload service, note the .new suffix as a
running service cannot be overwrittenscp X somehost:X.new
ssh gregory@somehost 'systemctl stop X; mv X.new bin/X; systemctl start X