Closed lostsoul6 closed 9 months ago
You can autostart the server by creating a systemd service file and enabling it.
Unfortunately, my script currently offers no shortcut to make the process easier. But I think that would be a good improvement overall.
Hi @dasisdormax ,
Can you please add option to autostart instances after reboot and also restart instantly after crashing ? I know you said to do it with systemd but there is a problem :
systemd's ExecStart only works as root user and msm throws out an error when running as root :
**FATAL:** in danger ( 133)
in main ( 39)
You are running cs2-server as root. This is unsupported and can
cause server malfunctions and security issues. Please consider
using a regular user instead of root.
If you know what you are doing and want to continue anyway,
export MSM_I_KNOW_WHAT_I_AM_DOING_ALLOW_ROOT=1 and try again.
Running it as root is a security risk based on what the message shows . I wish you could securely add an option for autostart after reboot and restart instances instantly after crashing .
BTW , what are the risks of running cs2-server as root? what can go wrong ?
@dasisdormax I tried with this but doesn't work :
[Unit]
Description=public 1 run
After=network.target
[Service]
User=steam
Group=steam
ExecStart=/usr/local/bin/cs2-server @public1 start
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
Any idea how I should achieve this?
You are almost there. I got it to work with Type=forking
. So in total, try this one:
[Unit]
Description=public 1 run
After=network.target
[Service]
User=steam
Group=steam
Type=forking
ExecStart=/usr/local/bin/cs2-server @public1 start
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
@dasisdormax thank you . it worked flawlessly .
Hello there ,
Is there anyway to autostart all instances after server is rebooted ?