torbov wrote:Thanks for the reply. Well, I install the .exe as a service - it works fine. But when I restart the server, it doesn't start again
I've looked the `systemd` documentation, but I couldn't do it to auto-start the process...
Oh but it can...
I would seriously suggest to sit down and get familiar with
systemd...
systemd units are
very powerful.
I've been using
systemd on Gentoo well before it was even "officially" supported...
I've got NFS
systemd network
automount/mount units for my NAS server that get torn down when the network connects and reconnects them when it is back up (e.g. suspend-resume cycle). Same with my SSHFS network mount. This connects over Internet back to my NAS at home. If my DynDNS resolution fails - then a fallback
systemd mount unit is run to connect to my NAS over my LAN (by hostname).
Similarly I've a
systemd autossh
service unit that creates a set of SSH tunnels to my NAS - so I can access various web frontends for servers remotely. These are torn down and recreated each time the network is stopped / restarted.
I know a lot of people that hate on
systemd - but personally I find it pretty useful.
I did some tests on my
Gentoo system...
Note: systemd unit paths vary between Linux distributions...
ROOT USER
Anyway for your particular case... You'd want to create a
systemd user unit similar to:
Code: Select all
[Unit]
Description=Persisent Diablo II Game Server
BindsTo=network.target
After=network.target
[Service]
# Set your WINEPREFIX here...
Environment="WINEPREFIX= ... "
# Set the full Windows path to your D2GS.EXE executable here...
Environment="D2GS_EXECUTABLE=C:\\d2gs.exe"
ExecStart=/usr/bin/wine ${D2GS_EXECUTABLE}
Restart=always
RestartSec=2s
[Install]
WantedBy=default.target
To stop
systemd complaining it can't find the
network.target - which is not accessible by default to
systemd user units:
Code: Select all
ln -s /lib/systemd/system/network.target /etc/systemd/user/
LINUX (WINE) USER
Code: Select all
# Reload all systemd unit files
systemctl --user daemon-reload
# Start d2gs.service to test
systemctl start --user d2gs.service
# Enable d2gs.service to start at every boot
systemctl enable --user d2gs.service
# Follow d2gs.service unit status in real time
journalctl --user --unit d2gs.service --follow
Took a bit of fiddling to get the service unit to run here. Check it runs OK with your full Diablo 2 Game Server setup - I didn't test this.
The
RestartSec=2s is necessary as
systemd has a throttle for service unit restarts (≤5 burst / 10 seconds is the default here).
Post your
journalctl log if you hit some issues...
Bob