[TOOL] L2J AIOLS - v2.2 - 10.10.15

Have you created a useful tool? or Do you want to get help building one? This is the right place!
Forum rules
READ NOW: L2j Forums Rules of Conduct
User avatar
zatei
Posts: 103
Joined: Sat Apr 10, 2010 11:25 am
Location: Russia

[TOOL] L2J AIOLS - v2.2 - 10.10.15

Post by zatei »

aiols-logo.jpg
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:
l2j_aiols_v2.2.zip
Very old, simple and stable:
l2_init_script_linux_v3.zip
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 :+1:
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 :D
User avatar
zatei
Posts: 103
Joined: Sat Apr 10, 2010 11:25 am
Location: Russia

Re: [TOOL] Linux init script

Post by zatei »

Admins, plz delete the old topic here - viewtopic.php?f=94&t=16819
Thanks!
Ay kan saey dat dis qest is bollsit cauise itz vaery problames in coaer drunk bear vodka matreshka balalaika...
Sorry for bad English :D
User avatar
UnAfraid
L2j Veteran
L2j Veteran
Posts: 4199
Joined: Mon Jul 23, 2007 4:25 pm
Location: Bulgaria
Contact:

Re: [TOOL] Linux init script

Post by UnAfraid »

MM.. if you kill the loader child process will left the java and i think server will continue working ?
Image
User avatar
zatei
Posts: 103
Joined: Sat Apr 10, 2010 11:25 am
Location: Russia

Re: [TOOL] Linux init script

Post by zatei »

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 :D
User avatar
Neo710
Posts: 26
Joined: Fri Apr 29, 2011 5:34 pm
Location: Italy

Re: [TOOL] Linux init script

Post by Neo710 »

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

Code: Select all

pkill [-SIGKILL | -SIGTERM] -f com.l2jserver.gameserver.GameServer
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.
Most of the problems of a PC are located between the keyboard and the chair!
User avatar
zatei
Posts: 103
Joined: Sat Apr 10, 2010 11:25 am
Location: Russia

Re: [TOOL] Linux init script

Post by zatei »

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.
Ay kan saey dat dis qest is bollsit cauise itz vaery problames in coaer drunk bear vodka matreshka balalaika...
Sorry for bad English :D
User avatar
diablodoro
Posts: 67
Joined: Thu Oct 11, 2007 8:54 pm

Re: [TOOL] Linux init script

Post by diablodoro »

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
User avatar
diablodoro
Posts: 67
Joined: Thu Oct 11, 2007 8:54 pm

Re: [TOOL] Linux init script

Post by diablodoro »

scripts work perfect if you start them from terminal
Terminal
........................................................
sudo su
password
cd /(files location)/
./game.sh && ./login.sh
........................................................
User avatar
zatei
Posts: 103
Joined: Sat Apr 10, 2010 11:25 am
Location: Russia

Re: [TOOL] Linux init script

Post by zatei »

bash: ./Login.sh: /bin/bash^M: bad interpreter: No such file or directory
You need to install bash interpreter, maybe in Ubuntu 10.04 you haven't this interpreter installed by default.
Ay kan saey dat dis qest is bollsit cauise itz vaery problames in coaer drunk bear vodka matreshka balalaika...
Sorry for bad English :D
User avatar
diablodoro
Posts: 67
Joined: Thu Oct 11, 2007 8:54 pm

Re: [TOOL] Linux init script

Post by diablodoro »

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 :)
User avatar
delix
Posts: 11
Joined: Sun Feb 06, 2011 9:52 pm
Location: Ukraine, Crimea, Eastern Еurope baby;)

Re: [TOOL] Linux init script

Post by delix »

Thx comrade :D ! works pretty well...
"Life is what happens to you while you're busy making other plans"
tsompanis
Posts: 1
Joined: Wed Aug 17, 2011 9:19 pm

Re: [TOOL] Linux init script

Post by tsompanis »

Doesn't work for me... for a reason i get this error

Code: Select all

 thessite@Element:~/L2Server$ sh l2_login : not found: : not found3: : not found6: l2_login: 87: Syntax error: word unexpected (expecting "in") 
and

Code: Select all

 thessite@Element:~/L2Server$ ./l2_login bash: ./l2_login: /bin/sh^M: bad interpreter: No such file or directory 
Well.. i got SH and BASH...

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 
I'm working on CrunchBang Linux (Debian Based)
User avatar
zatei
Posts: 103
Joined: Sat Apr 10, 2010 11:25 am
Location: Russia

Re: [TOOL] L2J AIOLS (v0.5 - 22.11.11)

Post by zatei »

First post updated.
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 :D
User avatar
zatei
Posts: 103
Joined: Sat Apr 10, 2010 11:25 am
Location: Russia

Re: [TOOL] L2J AIOLS - v0.5 - 22.11.11

Post by zatei »

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 :D
User avatar
BiggBoss
L2j Veteran
L2j Veteran
Posts: 1104
Joined: Wed Apr 15, 2009 3:11 pm
Location: Spain

Re: [TOOL] L2J AIOLS - v0.5 - 22.11.11

Post by BiggBoss »

nice bash skills
Image
Post Reply