Editing
Tutorials/Server startup script
(section)
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Init.d Script == For legacy Servers which don't have OS-integrated Systemd === Pre-Requisites === Screen package must be installed.<br> On CentOs and Red Hat-based distributions: <pre>yum install screen</pre> On Debian based systems such as Ubuntu: <pre>apt-get install screen python</pre> === Download === To download the script with wget, run the following (WATCH OUT SCRIPT NEEDS WORK - change the WORLD, MCPATH and BACKUPPATH variables.<br> '''Important:''' If you use the wget method and the first character of every line is an empty space, the script won't work and update-rc.d outputs errors. If so, you have to remove the leading empty spaces from each line. Be careful not to delete anything else than empty space though!) <pre>wget -O minecraft "http://minecraft.fandom.com/Tutorials/Server_startup_script/Script?action=raw"</pre> {{#tag:pre|{{/Script}}}} === Requirements === * [[Wikipedia:GNU Screen|screen]] * python (apt-get install python) === Installation === Use your favorite editor to create file called minecraft in /etc/init.d/ and paste the script above in that file. Edit the USERNAME and MCPATH -variables according to your setup. If you use a wrapper script, change INVOCATION to start it instead of starting the server directly. Make sure the newly created file has required permissions You can set the permissions by running: <pre>chmod a+x /etc/init.d/minecraft</pre> Then run (on Debian-based distributions) <pre>update-rc.d minecraft defaults</pre> Starting with Debian 6.0, the insserv command is used instead, if dependency-based booting is enabled. insserv will produce no output if everything went OK. Examine the error code in $? if you want to be sure. <pre>insserv minecraft</pre> On CentOs and RHEL(Redhat enterprise Linux) You will need to add the process into the chkconfig list chkconfig manages startup scripts under systemd <pre>chkconfig --add minecraft</pre> To check if the process is done correctly use the ntsysv command keep scrolling until you see the minecraft process if you don't repeat the chkconfig command. to add required symbolic links. Note: your system will most likely warn you that the script does not meet all requirements. The script will however work. You can also setup an entry in your [[Wikipedia:Cron|crontab]] to backup the server. A sample crontab to backup every half hour on the hour, and 30 minutes into the hour: * Using the user account you want the work done under, run: <pre>crontab -e</pre> and add this <pre>0,30 * * * * /etc/init.d/minecraft backup</pre> If the process is unsuccessful, try: <pre>VISUAL=/usr/bin/nano crontab -e</pre> === Uninstall === (In debian based GNU/Linux distribution) <pre>update-rc.d -f minecraft remove</pre> (In CentOs/RHEL) <pre>chkconfig --del minecraft</pre> === Usage === The script may be invoked via the following command on most systems, where "(command)" will be "stop", "start", "restart", or any of the other options it supports. <pre>/etc/init.d/minecraft (command)</pre> On most RedHat- or Debian-based distribution where the `service` command is available, it should be invoked as: <pre>service minecraft (command)</pre> To view the screen, use: <pre>screen -r</pre> To exit the screen, use: <pre>CTRL+a+d</pre> === References === * http://www.debian-administration.org/articles/28 * https://wiki.debian.org/LSBInitScripts/DependencyBasedBoot === Extra information === If you still want to view the live log file, use this command in the server directory. <pre>tail -f logs/latest.log</pre>
Summary:
Please note that all contributions to Kiiw may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Kiiw:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
View history
More
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Tools
What links here
Related changes
Special pages
Page information