Talk:Tutorials/Server startup script

Is the server updater working for anyone? I remember trying it a couple of times and it not working. Nosrepa 08:20, 19 May 2011 (UTC) ~

Anyone have any experience setting this script up? I'm having trouble getting it to work on a Linode running Ubuntu 10.4.

The problem seems to be sending a command to screen. Even if I create the screen first, then detach it, I can't send a command to it. The only way to start the server is to attach to the screen and run the command from there, then detach to get back to my main session.

I can still send commands to the screen after the server is running, though. It's really odd. Any input on this would be great, and I can provide any additional info as well.

Thanks

You're encountering this bug: http://savannah.gnu.org/bugs/?25813 If you compile a version of screen from head it should work. Riff Zifnab 21:16, 28 May 2011 (UTC)

Works fine for me. Only problem is that it only takes 6 backups total per day and then stops working. --Barely 22:33, 26 April 2011 (UTC)

Untested, but it appears the reason why it only allows 6 backups is becasue of for i in 1 2 3 4 5 6 When the code sees the "world_YYYYMMDD-#"backup with the same date and a trailing 6, it continues through the for loop. Since the for loop only goes up to 6, the for loop is over at that point, so nothing is done.

A better (not the best) way to do this is to figure out how many backups you plan on running in a day ( every 30 minutes would be 24 per day). Replace the above text with... for i in $(seq 24) There are two occurrences in the script. Again, this is untested, so backup your script! --Ischwarz3 20:17, 27 April 2011 (UTC)

---

Thanks for the reply. I looked into the script myself without checking here, and figured I would take about 50 backups per day. I actually changed that line to this:

for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50

It works fine now. It doesn't stop at 6 backups a day like before, and I'm in the 20s already so it seems to work. It doesn't backup the jar though, but I could care less about the .jar. I could live with taking just one a day, in my opinion the jar backup isn't needed.

I'm sure there's a better way to do that :P However I don't really know too much about bash, let alone unix coding. Also, backups every 30 minutes would be 48 backups, not 24. ;)

I'm going to setup a cronjob to tar all of the backups for the day into one file. This will make archiving easier, because each backup is ~20 MBs. The only problem is deleting the old, untarred backups. I'd probably run the script at midnight. (well, 2 minutes after. Backups are on the hour, every hour now.)

Thanks!

--Barely 02:51, 28 April 2011 (UTC)

Graceful shutdown
Has anyone tested this script in an external shutdown situation, where gracefully stopping the minecraft server is crucial?

In my testing, the script appears to run on e.g. 'shutdown -h now', but by the time that happens, the screen and java processes have already been killed. Using Debian 6 so installed it with 'insserv minecraft' which seems to be the preferred method now, as opposed to update-rc.d. In /etc/rc0.d for example, there's a K01minecraft symlink, which comes before K02sendsigs, so all seems right?

Really nifty script works perfectly for me. One thing that bothers me is that when I try to send commands to the screen session the same way this script does I get a permission denied. I've turned on correct settings in .screenrc. addacl www-data multiuser on I can -r into the session as the www-data user but sending commands seems to be another story. Googling on the subject gives some results on people asking the same question as me. So I was thinking maybe someone from the source of the script might be interfacing with minecraft from the webserver. --Husse 08:59, 20 June 2011 (UTC)