[TOOL] L2J AIOLS - v2.2 - 10.10.15
Forum rules
READ NOW: L2j Forums Rules of Conduct
READ NOW: L2j Forums Rules of Conduct
- zatei
- Posts: 103
- Joined: Sat Apr 10, 2010 11:25 am
- Location: Russia
[TOOL] L2J AIOLS - v2.2 - 10.10.15
SUMMARY
Name: L2J AIOLS (All In One Linux Script)
Description:
Script for Linux (with bash 4.x.x or bash 4.x.x compatible shell) based L2J Servers created to simplify routine admin tasks. It provides functionality of "init" script for running/stopping/restarting your server, pull/build/install/reinstall/update/backup automation functions and other useful stuff.
Since v1.0 branch it replaces functionality of loader and loop scripts from DP and provides wide configuration of startup parameters. You can edit XmX, XmS, etc. right in well commented config section and fine-tune startup parameters as you wish.
Downloads:
Stable version: Very old, simple and stable: Capabilities:
Basic "init" functions to start/stop/restart server.
Function to terminate hanged server if nothing else works.
Support of multiple Login or Game servers on one machine using PIDfiles.
Automatic install/reinstall/update with run of dbinst_** and chmod of *.sh executables.
Automatic backup during reinstall/update to configurable folder with date/time based naming and zipping/tar7zipping.
Automatic download of Server/Datapack archives from provided links.
Automatic pull of Server/Datapack projects from provided GIT URL's.
Automatic building of projects using new Gradle build system.
Standalone pull/build/update/backup commands with same capabilities.
Automatic restoring of old geodata/pathnodes from last backup after reinstalling.
Function to show stdout.log output in realtime.
Basic commands:
"start" - Start server.
"start tail" or "stail" - Start server and show output.
"stop" - Stop server.
"stop tail" or "stoil" - Stop server and show output.
"restart" - Restart server.
"restart tail" or "restail" - Restart server and show output.
"kill" - Kill hanged server.
"kill tail" or "kitail" - Kill hanged server and show output.
"rekill" - Kill and then start hanged server.
"rekill tail" or "rekitail" - Kill and then start hanged server and show output.
"tail" - Show server's stdout.log output in realtime.
Advanced commands:
"pull" - Pull ZIP archive/clone GIT repo.
"make" or "make target" - Build local/cloned Gradle project.
"update" - Stop, backup and update server.
"backup" - Stop and backup server.
"clean" - Clean temp and build folders if any.
"clean all" - Clean temp, build and grails cache if any.
Shorthands:
"pm" or "pm target" - Pull, make.
"pu" - Pull, update.
"mu" or "mu target" - Make, update.
"pmu" or "pmu target" - Pull, make, update.
HOWTO
Install the script:
Depending on the system you need to put the script into init directory, "/etc/init.d" on Debian based systems for example. Edit config section as you like and don't forget to chmod +x it! To use the script with multiple servers on one machine you need to install and configure it several times, one script per server. It uses PIDfiles to determine the server to work with.
Update your server:
First thing is what's happening when you are using "install/reinstall" option when prompted. Most of devs want to keep their projects and deployed builds very clean. When such dev is updating something he always backups current deployed build then fully removes it and replaces with freshly generated build from his project. This logic will prevent very many mistakes/trash in future and you may be sure that deployed server fully corresponds to the project. So, "install/reinstall" option will update the server by using this logic exactly, it will remove old deployed build and fully replace it with a new one.
Second thing is what's happening when you are using "update" option when prompted. Unlike the previous example this option does not remove old deployed build at all, it will replace only older files in current deployed build to newer files from the freshly generated build by comparing "last modified" date. So, if file in current deployed build have the same or newer "last modified" date than file from freshly generated build it will not be replaced. That sounds good but i really not recommend you to use this option because there is a lot of ways to accidentally change the "last modified" date, for example by simply copying the file. That makes the update process unpredictable and unsafe and as a result you can loose your work.
Use predefined answers:
There is a WORKFLOW DEFAULTS section where you can find all default answers that can de asked during the script exec. I have no time to describe each of them and they can be changed in future so you need to read the code and find yourself what they do. You can predefine the workflow and change ASK variable to "false" to achieve automatic backup, update, etc. Another way to use this awesome ability is to pass answers as parameters at command line.
Use other functions:
All functionality is made to be self-descriptive or descripted in config section of the script. Please read it carefully before asking here
Name: L2J AIOLS (All In One Linux Script)
Description:
Script for Linux (with bash 4.x.x or bash 4.x.x compatible shell) based L2J Servers created to simplify routine admin tasks. It provides functionality of "init" script for running/stopping/restarting your server, pull/build/install/reinstall/update/backup automation functions and other useful stuff.
Since v1.0 branch it replaces functionality of loader and loop scripts from DP and provides wide configuration of startup parameters. You can edit XmX, XmS, etc. right in well commented config section and fine-tune startup parameters as you wish.
Downloads:
Stable version: Very old, simple and stable: Capabilities:
Basic "init" functions to start/stop/restart server.
Function to terminate hanged server if nothing else works.
Support of multiple Login or Game servers on one machine using PIDfiles.
Automatic install/reinstall/update with run of dbinst_** and chmod of *.sh executables.
Automatic backup during reinstall/update to configurable folder with date/time based naming and zipping/tar7zipping.
Automatic download of Server/Datapack archives from provided links.
Automatic pull of Server/Datapack projects from provided GIT URL's.
Automatic building of projects using new Gradle build system.
Standalone pull/build/update/backup commands with same capabilities.
Automatic restoring of old geodata/pathnodes from last backup after reinstalling.
Function to show stdout.log output in realtime.
Basic commands:
"start" - Start server.
"start tail" or "stail" - Start server and show output.
"stop" - Stop server.
"stop tail" or "stoil" - Stop server and show output.
"restart" - Restart server.
"restart tail" or "restail" - Restart server and show output.
"kill" - Kill hanged server.
"kill tail" or "kitail" - Kill hanged server and show output.
"rekill" - Kill and then start hanged server.
"rekill tail" or "rekitail" - Kill and then start hanged server and show output.
"tail" - Show server's stdout.log output in realtime.
Advanced commands:
"pull" - Pull ZIP archive/clone GIT repo.
"make" or "make target" - Build local/cloned Gradle project.
"update" - Stop, backup and update server.
"backup" - Stop and backup server.
"clean" - Clean temp and build folders if any.
"clean all" - Clean temp, build and grails cache if any.
Shorthands:
"pm" or "pm target" - Pull, make.
"pu" - Pull, update.
"mu" or "mu target" - Make, update.
"pmu" or "pmu target" - Pull, make, update.
HOWTO
Install the script:
Depending on the system you need to put the script into init directory, "/etc/init.d" on Debian based systems for example. Edit config section as you like and don't forget to chmod +x it! To use the script with multiple servers on one machine you need to install and configure it several times, one script per server. It uses PIDfiles to determine the server to work with.
Update your server:
First thing is what's happening when you are using "install/reinstall" option when prompted. Most of devs want to keep their projects and deployed builds very clean. When such dev is updating something he always backups current deployed build then fully removes it and replaces with freshly generated build from his project. This logic will prevent very many mistakes/trash in future and you may be sure that deployed server fully corresponds to the project. So, "install/reinstall" option will update the server by using this logic exactly, it will remove old deployed build and fully replace it with a new one.
Second thing is what's happening when you are using "update" option when prompted. Unlike the previous example this option does not remove old deployed build at all, it will replace only older files in current deployed build to newer files from the freshly generated build by comparing "last modified" date. So, if file in current deployed build have the same or newer "last modified" date than file from freshly generated build it will not be replaced. That sounds good but i really not recommend you to use this option because there is a lot of ways to accidentally change the "last modified" date, for example by simply copying the file. That makes the update process unpredictable and unsafe and as a result you can loose your work.
Use predefined answers:
There is a WORKFLOW DEFAULTS section where you can find all default answers that can de asked during the script exec. I have no time to describe each of them and they can be changed in future so you need to read the code and find yourself what they do. You can predefine the workflow and change ASK variable to "false" to achieve automatic backup, update, etc. Another way to use this awesome ability is to pass answers as parameters at command line.
Use other functions:
All functionality is made to be self-descriptive or descripted in config section of the script. Please read it carefully before asking here
You do not have the required permissions to view the files attached to this post.
Last edited by zatei on Fri Oct 09, 2015 11:22 pm, edited 36 times in total.
Ay kan saey dat dis qest is bollsit cauise itz vaery problames in coaer drunk bear vodka matreshka balalaika...
Sorry for bad English
Sorry for bad English
- zatei
- Posts: 103
- Joined: Sat Apr 10, 2010 11:25 am
- Location: Russia
Re: [TOOL] Linux init script
Admins, plz delete the old topic here - viewtopic.php?f=94&t=16819
Thanks!
Thanks!
Ay kan saey dat dis qest is bollsit cauise itz vaery problames in coaer drunk bear vodka matreshka balalaika...
Sorry for bad English
Sorry for bad English
- UnAfraid
- L2j Veteran
- Posts: 4199
- Joined: Mon Jul 23, 2007 4:25 pm
- Location: Bulgaria
- Contact:
Re: [TOOL] Linux init script
MM.. if you kill the loader child process will left the java and i think server will continue working ?
- zatei
- Posts: 103
- Joined: Sat Apr 10, 2010 11:25 am
- Location: Russia
Re: [TOOL] Linux init script
Script kills all ^)
Ay kan saey dat dis qest is bollsit cauise itz vaery problames in coaer drunk bear vodka matreshka balalaika...
Sorry for bad English
Sorry for bad English
- Neo710
- Posts: 26
- Joined: Fri Apr 29, 2011 5:34 pm
- Location: Italy
Re: [TOOL] Linux init script
Sry if I necrothread this, but I'm in a strange situation:
I have one login server and 2 gameservers running. I can change the name of the loader scripts so I can kill the right process of the loader, but when I kill the java thread, both of the servers shut down! In fact the script uses the command
but the only difference between the threads of the servers is the PID and the above command kill both of the java threads!
Same for the community servers.
Anyone knows a work around that can make me stop ONLY the right process? Of course I'm speaking about one automatic script, if I have to stop them manually from shell I have only to look at the PID of the loader and SIGTERM the consecutive PID (java).
Tnx a lot.
I have one login server and 2 gameservers running. I can change the name of the loader scripts so I can kill the right process of the loader, but when I kill the java thread, both of the servers shut down! In fact the script uses the command
Code: Select all
pkill [-SIGKILL | -SIGTERM] -f com.l2jserver.gameserver.GameServer
Same for the community servers.
Anyone knows a work around that can make me stop ONLY the right process? Of course I'm speaking about one automatic script, if I have to stop them manually from shell I have only to look at the PID of the loader and SIGTERM the consecutive PID (java).
Tnx a lot.
Most of the problems of a PC are located between the keyboard and the chair!
- zatei
- Posts: 103
- Joined: Sat Apr 10, 2010 11:25 am
- Location: Russia
Re: [TOOL] Linux init script
Hi!
In this situation the best way to kill right server is write PID of the server to file on loading and kill this PID on stopping.
I have no time to do it myself but you can look to any init script that using this method. Apache or MySQL for examle.
In this situation the best way to kill right server is write PID of the server to file on loading and kill this PID on stopping.
I have no time to do it myself but you can look to any init script that using this method. Apache or MySQL for examle.
Ay kan saey dat dis qest is bollsit cauise itz vaery problames in coaer drunk bear vodka matreshka balalaika...
Sorry for bad English
Sorry for bad English
- diablodoro
- Posts: 67
- Joined: Thu Oct 11, 2007 8:54 pm
Re: [TOOL] Linux init script
scripts dont work on ubuntu 10_04 i dont know why after start they auto close
i think its becouse of the new MySql databace : l2jls L2jgs
im using version :
Version : 4661
Builddate : 20110608_0500
is some one have some idea how to fix it plz help
10x alot
PC i try this scrip too
.......................................................................................................................................
#!/bin/bash
cd /home/loggon/L2J/login/
xterm -title 'LoginServer Log' -e tail -f /home/loggon/L2J/login/log/stdout.log &
./LoginServer_loop.sh
.......................................................................................................................................
and i get error
bash: ./Login.sh: /bin/bash^M: bad interpreter: No such file or directory
i think its becouse of the new MySql databace : l2jls L2jgs
im using version :
Version : 4661
Builddate : 20110608_0500
is some one have some idea how to fix it plz help
10x alot
PC i try this scrip too
.......................................................................................................................................
#!/bin/bash
cd /home/loggon/L2J/login/
xterm -title 'LoginServer Log' -e tail -f /home/loggon/L2J/login/log/stdout.log &
./LoginServer_loop.sh
.......................................................................................................................................
and i get error
bash: ./Login.sh: /bin/bash^M: bad interpreter: No such file or directory
- diablodoro
- Posts: 67
- Joined: Thu Oct 11, 2007 8:54 pm
Re: [TOOL] Linux init script
scripts work perfect if you start them from terminal
Terminal
........................................................
sudo su
password
cd /(files location)/
./game.sh && ./login.sh
........................................................
Terminal
........................................................
sudo su
password
cd /(files location)/
./game.sh && ./login.sh
........................................................
- zatei
- Posts: 103
- Joined: Sat Apr 10, 2010 11:25 am
- Location: Russia
Re: [TOOL] Linux init script
You need to install bash interpreter, maybe in Ubuntu 10.04 you haven't this interpreter installed by default.bash: ./Login.sh: /bin/bash^M: bad interpreter: No such file or directory
Ay kan saey dat dis qest is bollsit cauise itz vaery problames in coaer drunk bear vodka matreshka balalaika...
Sorry for bad English
Sorry for bad English
- diablodoro
- Posts: 67
- Joined: Thu Oct 11, 2007 8:54 pm
Re: [TOOL] Linux init script
well i had bash installed the problem was that the login.sh needed to start from root when i start it from normal terminal i get error but when i start if from root everithing work fine
- delix
- Posts: 11
- Joined: Sun Feb 06, 2011 9:52 pm
- Location: Ukraine, Crimea, Eastern Еurope baby;)
Re: [TOOL] Linux init script
Thx comrade ! works pretty well...
"Life is what happens to you while you're busy making other plans"
-
- Posts: 1
- Joined: Wed Aug 17, 2011 9:19 pm
Re: [TOOL] Linux init script
Doesn't work for me... for a reason i get this error
and
Well.. i got SH and BASH...
I'm working on CrunchBang Linux (Debian Based)
Code: Select all
thessite@Element:~/L2Server$ sh l2_login : not found: : not found3: : not found6: l2_login: 87: Syntax error: word unexpected (expecting "in")
Code: Select all
thessite@Element:~/L2Server$ ./l2_login bash: ./l2_login: /bin/sh^M: bad interpreter: No such file or directory
Code: Select all
thessite@Element:~/L2Server$ whereis bashbash: /bin/bash /etc/bash.bashrc /usr/share/man/man1/bash.1.gzthessite@Element:~/L2Server$ whereis shsh: /bin/sh.distrib /bin/sh /usr/share/man/man1/sh.1.gz
- zatei
- Posts: 103
- Joined: Sat Apr 10, 2010 11:25 am
- Location: Russia
Re: [TOOL] L2J AIOLS (v0.5 - 22.11.11)
First post updated.
New version 0.5.
New version 0.5.
Ay kan saey dat dis qest is bollsit cauise itz vaery problames in coaer drunk bear vodka matreshka balalaika...
Sorry for bad English
Sorry for bad English
- zatei
- Posts: 103
- Joined: Sat Apr 10, 2010 11:25 am
- Location: Russia
Re: [TOOL] L2J AIOLS - v0.5 - 22.11.11
First post updated, added some info.
Ay kan saey dat dis qest is bollsit cauise itz vaery problames in coaer drunk bear vodka matreshka balalaika...
Sorry for bad English
Sorry for bad English
- BiggBoss
- L2j Veteran
- Posts: 1104
- Joined: Wed Apr 15, 2009 3:11 pm
- Location: Spain