Emperor Servers

How to make servermanager start automaticly at boot(Linux)

i have my ACservermanager running perfectly on a virtual linux-host, but i want it to start automaticly at boot.

i know a little of etc/crontab but can’t get it to start automaticly
i edited crontab with crontab -e
and added this line:
@reboot /home/AssettoCorsaServer/server-manager

(i tried both “server-manager” and “server-manager.sh” and “.server-manager”)
and checked the status after rebooting with sudo systemctl status cron:

root@******:~# sudo systemctl status cron

  • cron.service - Regular background program processing daemon
    Loaded: loaded (/lib/systemd/system/cron.service; enabled; preset: enabled)
    Active: active (running) since Wed 2023-11-15 15:26:25 CET; 20s ago
    Docs: man:cron(8)
    Main PID: 88 (cron)
    Tasks: 1 (limit: 18937)
    Memory: 300.0K
    CPU: 16ms
    CGroup: /system.slice/cron.service
    `-88 /usr/sbin/cron -f

Nov 15 15:26:25 ****** systemd[1]: Started cron.service - Regular background program processing daemon.
Nov 15 15:26:25 ****** cron[88]: (CRON) INFO (pidfile fd = 3)
Nov 15 15:26:25 ****** cron[88]: (CRON) INFO (Running @reboot jobs)
Nov 15 15:26:25 ****** CRON[94]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Nov 15 15:26:25 ****** CRON[95]: (root) CMD (/home/AssettoCorsaServer/server-manager.sh)
Nov 15 15:26:25 ****** CRON[94]: pam_unix(cron:session): session closed for user root

there seems to be running something, but the webinterface isn’t up.

i cannot start it manually without disabling the entry in crontab first and reboot.

what am i doing wrong?

i got help from @shock_ on the discord-server and got it to work. here’s how:

put 777 rights on /home/servermanager (and all sub-folders) whereever yourserver manager is

adduser assetto

and gave it superpowers with: usermod -aG sudo assetto

then created a new file /etc/systemd/system/ac-server-manager.service and pasted the following in it:

[Unit]

Description=Start Assetto Corsa Server Manager

After=network.target

Wants=network-online.target

[Service]

Restart=always

Type=simple

ExecStart=/home/servermanager/ac-server-manager

KillSignal=SIGINT

WorkingDirectory=/home/servermanager

User=assetto

Group=assetto

[Install]

WantedBy=multi-user.target

to enable the service:

sudo systemctl enable ac-server-manager.service

to stop/start:

sudo systemctl stop ac-server-manager.service

sudo systemctl start ac-server-manager.service ``

to check status:
journalctl -u ac-server-manager.service

sudo systemctl status ac-server-manager.service

all kudos to Shock_ !