Daemon to manage cuberite and autostart script [info & download]
#1
Hi, i've been redoing my scripts, in order to tidy up all the code, and merge all so I ended up with 2 files, the cuberite.sh with all the functions and the cuberite file to use as daemon, I share it here in case anyone is interested, it doesn't compile the latest source, just use Jenkins builds, is working fine on Raspberry Pi 1 & 2 running Debian Jessie and Ubuntu X64/x86 , it won't work with Odroid.

Im running all the commands under root.

Daemon functions :
 
Code:
   start             -> Starts Cuberite Server.
   stop             -> Stops Cuberite Server.
   restart             -> Restarts Cuberite Server without updating or warning the online users (HARDRESET)
   update             -> Updates Cuberite Server to the latest available build.
   maintenance         -> Restarts Cuberite Server, sends a 5 minute warning to online users and updates Cuberite.
   status             -> Shows the status of the server [online/offline].
   log               -> View the latest logfile from the server.
   live               -> Switch to the current server instance (Real time logs)
   install               -> Install dependencies and Cuberite server.
   help             -> Shows this help page.


Insallation & Config:


Download the script and daemon:

Code:
wget https://www.dropbox.com/s/kp5xkzi2ng29cqk/cuberitedaemon.tar.gz


Extract the file in a folder of your choice:

Code:
tar -xvzf cuberitedaemon.tar.gz

You have to see now, 2 files, one named "cuberite" and another one named "cuberite.sh"


First of all edit cuberite.sh (use the editor that you want):

Code:
nano cuberite.sh


Line 4, modify the last path (after the last : )   /root/cuberite.sh to point to the folder where you have the script:

Code:
##Configuration
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/cuberite.sh



Line 15, modify the variables to point to the location where you want cuberite to be installed, if you already have a working server, backup your folder first in case anything will go wrong, and then modify the variable to point your current server folder.

Code:
## Cuberite Directory
CUBERITEDIR="/root/MCServer/"

Line 17, the cache directory, as before modify it to the folder where you want the cache to be, leave it hidden and outside the Server folder.

Code:
## Cache Directory
CACHEDIR="/root/.cuberiteupdate/"

Save the changes and exit the file.

Now edit the other file named "cuberite":

Code:
nano cuberite

Line 15, change the path to point to the cuberite.sh script

Code:
## Cuberite Directory
SCRIPTPATH="/root/cuberite.sh"


Save and exit.

Move the file to /etc/init.d/:

Code:
mv cuberite /etc/init.d/


Give permissions to the file:

Code:
chmod 775 cuberite


And register the script to start on boot:

Code:
update-rc.d cuberite defaults

And you're done.

Let's install Cuberite now, if this is not a fresh install please make a backup of your server folder before executing the command.

Code:
service cuberite install

This will install screen if you don't have it in your system, and then download the latest build and start the server.

You can stop the server to change the default config files:

Code:
service cuberite stop

And in case you want to switch to the current running server instance, to see the log in real time:

Code:
service cuberite live

This will resume the detached screen session, to get back to your terminal, press Ctrl+a+d in order to return without killing the session.

For other functions take a look at the info in the top of this post, or just type service cuberite help to see the available commands.

Hope it's useful to others, I will update it with more features when I have more time.

   
Reply
Thanks given by: Gnubrew
#2
UPDATE 1:

- Added install command for fresh installs, it also install dependencies like screen.
- Added live command to switch to the current session of Cuberite to see real time logs, execute server commands directly etc.
- Fixed a bug in the log command.
- Added root warning.
Reply
Thanks given by:
#3
I've several new options almost ready, let's encrypt is one of them, the other one is the backup option, for now it just make a tar.gz of the entire server folder. I was thinking of integrating it with some cloud services to automate backups and upload them to Dropbox, Drive etc.

Is anyone interested in this last option? if not I would leave it like it is, only backup, no upload.
If you are could you tell me which of these cloud services are you most interested in?
Since nobody reply to this post I don't know if there is interested on using the script or if it is actually being used.

I would appreciate some feedback.

Thanks.
Reply
Thanks given by:
#4
Yes - I will test this out as this is very useful. However, why won't it work on odroid, for example?
Reply
Thanks given by:
#5
(09-11-2016, 08:29 AM)dwmcqueen Wrote: Yes - I will test this out as this is very useful.  However, why won't it work on odroid, for example?

It doesn't work on odroid because by the time there weren't odroid builds on the jenkins server. And you need to compile from source, because the ARM builds for Raspberry Pi don't work in Odroid, some libs were diferent and the resulting build always failed if it wasn't compile for Odroid.

I think there are users testing the auto buids for Odroid from the jenkins server, i tried a few days ago but the links were dead.

I left this unfinished because I didn't see too many people interested on it by the time, but I can add odroid builds, compile and other options I left unwritten.

But feel free to modify, share or do as you please with the script, I will add these options once I have a little time.

Thanks for the feedback.
Reply
Thanks given by:
#6
(02-28-2016, 11:32 PM)Rekuen Wrote: UPDATE 1:

- Added install command for fresh installs, it also install dependencies like screen.
- Added live command to switch to the current session of Cuberite to see real time logs, execute server commands directly etc.
- Fixed a bug in the log command.
- Added root warning.

Hi Rekuen,
i tried many different way´s to autostart Cuberite with my Raspberry Pi 3.


At least i tried your way. It worked! Thanks a lot!!

But you say the script just checks the latest build version from Jenkins.
Now in the latest version there is no sound if someone kills animals or zombies.. whatever.. 

Every other Sound works great. I read in at github that this is a known issue, they changed some sound id´s from 1.8 to 1.9 Version...

So my Question to you is, is the latest build really without Sound (Animals,Zombies)??
At first, i dont know the running version of Cuberite minecraft Server..?

Maybe its nessecery to update your script? 

Thanks for your help!
Reply
Thanks given by:
#7
(12-27-2016, 06:24 AM)Brachi Wrote:
(02-28-2016, 11:32 PM)Rekuen Wrote: UPDATE 1:

- Added install command for fresh installs, it also install dependencies like screen.
- Added live command to switch to the current session of Cuberite to see real time logs, execute server commands directly etc.
- Fixed a bug in the log command.
- Added root warning.

Hi Rekuen,
i tried many different way´s to autostart Cuberite with my Raspberry Pi 3.


At least i tried your way. It worked! Thanks a lot!!

But you say the script just checks the latest build version from Jenkins.
Now in the latest version there is no sound if someone kills animals or zombies.. whatever.. 

Every other Sound works great. I read in at github that this is a known issue, they changed some sound id´s from 1.8 to 1.9 Version...

So my Question to you is, is the latest build really without Sound (Animals,Zombies)??
At first, i dont know the running version of Cuberite minecraft Server..?

Maybe its nessecery to update your script? 

Thanks for your help!

Hi! I'm glad it worked for you, Is been a while since I checked the script or updated it because I didn't get too many responses so I supposed people weren't using it.

About the sound problem is a known issue, the scripts always downloads the latest compiled version of Cuberite from the Jenkins page, so once a new build is generated at the Jenkins server with that particular issue solved you can just launch the update option of the script and it will update your version.

Unless they have changed the urls for the Jenkins builds and is no longer finding a new version. I will check it as soon as I have time. I have to set a raspberry Pi because now I'm using an Odroid X4, and I'm planning to update the script so it works with Odroid too now that there are also builds for these devices at the Jenkins server.

I hope that answer to your question.
If you are missing a feature that you would like to have or something is not working properly just tell me and I would try to fix it as soon as I have some time free from work.
Reply
Thanks given by:
#8
I've checked the script from a clean install on a Raspberry Pi 2, with the latest raspbian minimal image, and is working properly.
The first time takes some time to start because of the world generation, maybe I should put some progress bar or something, but everything else is working fine.

As for the version of Cuberit that is being install, is Build #638 build today (Jan 13, 2017 9:37:25 AM), so the updates are still working as usual.
Reply
Thanks given by:
#9
(01-14-2017, 06:40 AM)Rekuen Wrote: I've checked the script from a clean install on a Raspberry Pi 2, with the latest raspbian minimal image, and is working properly.
The first time takes some time to start because of the world generation, maybe I should put some progress bar or something, but everything else is working fine.

As for the version of Cuberit that is being install, is Build #638 build today (Jan 13, 2017 9:37:25 AM), so the updates are still working as usual.

Hey Rekuen,
thanks for checking the script!! 

Really like it! 

Smile best wishes
Brachi
Reply
Thanks given by:
#10
Is there anyone interested in Odroid Builds? I've seen there are binary builds available in the Jenkins server so is easy to update the script to support that hardware too.
Reply
Thanks given by:




Users browsing this thread: 8 Guest(s)