PDA

View Full Version : Debian Server Start On Boot


djeryv
08-15-2018, 05:00 PM
Can anyone tell me how to get the server_start_with_login.sh to start at bootup? I tried the cron method, and there is no rc.local on Debian anymore. I tried doing systemd but all of these methods seem to start the server and then it shuts itself down.

Huppy
08-15-2018, 05:23 PM
Found this little tip, not sure if it works.
https://www.itechlounge.net/2017/10/linux-how-to-add-rc-local-in-debian-9/

djeryv
08-15-2018, 06:20 PM
Same thing. The server starts and then shuts itself down.

djeryv
08-15-2018, 06:58 PM
I finally got it working by putting the below in my crontab. I am not sure if I need the delay...or to direct the output to NULL. I tried to delay it in various ways during my trial and error without success though, so maybe the redirected output? Oh well...just glad it is working.

@reboot sleep 30 && /home/eqemu/server/server_start_with_login.sh > /dev/null 2>&1

Akkadius
08-15-2018, 07:49 PM
I finally got it working by putting the below in my crontab. I am not sure if I need the delay...or to direct the output to NULL. I tried to delay it in various ways during my trial and error without success though, so maybe the redirected output? Oh well...just glad it is working.

@reboot sleep 30 && /home/eqemu/server/server_start_with_login.sh > /dev/null 2>&1

Hey djeryv! A name I've not seen in quite a while, hope all is well.

@reboot in the crontab works fine, you really don't need the delay.

However, I would recommend that you first cd into the server directory because running the server binaries and everything it loads is contextual of the server directory. So:

@reboot cd /home/eqemu/server && ./server_start_with_login.sh > /dev/null 2>&1

djeryv
08-15-2018, 08:19 PM
Yeah...I noticed that issue as well so I put it in the shell script instead.

jpyou127
08-17-2018, 05:09 PM
Wow I have been asking this question for 5 years with no answer and tried some of those things you did, but never got it to work.

djeryv
08-17-2018, 08:17 PM
So none of this stuff here worked for you? Because it worked for me on the latest Debian.

jakaleca
08-17-2018, 10:08 PM
Greetings, Djeryv

You have been deeply missed by many of us around here. There have been many requests for your old solo server files over the years, and innumerable attempts to recreate a fun "legit" solo type server, with widely-varied results.

Here's hoping you are well and prosperous.

Best Regards

jpyou127
08-18-2018, 10:02 AM
I had been learning linux at the time and its been a while since I have loaded up an EQEMU on linux. I moved to windows since one of the things was not being able to get it to auto start on a reboot. I am a newbie at linux! When crontab is mentioned, where is that?

djeryv
08-18-2018, 05:52 PM
usually you just type "crontab -e" to edit it. When you do this for the first time, it will ask you what editor you are going to use to edit it.

timber28
03-21-2019, 06:28 PM
Here is a tad better way to do it (I try to avoid doing stuff like this in cron), if you want to be able to control it with systemctl.

Edit the server_start script you want to use and server_stop.sh and add a cd /home/eqemu/server (or wherever you installed it) as the 2nd line.

#!/usr/bin/env bash
cd /home/eqemu/server

Then create this in /etc/systemd/system as eqemu.service

[Unit]
Description=EQ Emulator Server with Login server
After=mysql.service

[Service]
User=eqemu
Group=eqemu
Type=forking
ExecStart=/home/eqemu/server/server_start_with_login.sh
ExecStop=/home/eqemu/server/server_stop.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target

Then run systemctl daemon-reload
This will let you see the status of the service with systemctl status eqemu, and you can start/stop the server with the normal start/stop commands.

Don't forget to systemctl enable eqemu to enable it starting at boot.