Page 1 of 4

[TOOL] L2J AIOLS - v2.2 - 10.10.15

Posted: Thu May 13, 2010 9:46 pm
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:

Re: [TOOL] Linux init script

Posted: Tue May 25, 2010 6:13 pm
by zatei
Admins, plz delete the old topic here - viewtopic.php?f=94&t=16819
Thanks!

Re: [TOOL] Linux init script

Posted: Sun Jun 06, 2010 3:02 am
by UnAfraid
MM.. if you kill the loader child process will left the java and i think server will continue working ?

Re: [TOOL] Linux init script

Posted: Sun Jun 06, 2010 3:58 pm
by zatei
Script kills all ^)

Re: [TOOL] Linux init script

Posted: Tue May 03, 2011 1:19 pm
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.

Re: [TOOL] Linux init script

Posted: Wed May 11, 2011 4:17 pm
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.

Re: [TOOL] Linux init script

Posted: Thu Jun 09, 2011 10:10 am
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

Re: [TOOL] Linux init script

Posted: Fri Jun 10, 2011 2:02 pm
by diablodoro
scripts work perfect if you start them from terminal
Terminal
........................................................
sudo su
password
cd /(files location)/
./game.sh && ./login.sh
........................................................

Re: [TOOL] Linux init script

Posted: Wed Jun 15, 2011 12:56 pm
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.

Re: [TOOL] Linux init script

Posted: Wed Jun 15, 2011 2:48 pm
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 :)

Re: [TOOL] Linux init script

Posted: Sun Jul 31, 2011 2:30 pm
by delix
Thx comrade :D ! works pretty well...

Re: [TOOL] Linux init script

Posted: Thu Aug 18, 2011 11:57 am
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)

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

Posted: Tue Nov 22, 2011 10:06 am
by zatei
First post updated.
New version 0.5.

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

Posted: Tue Nov 22, 2011 6:35 pm
by zatei
First post updated, added some info.

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

Posted: Tue Nov 22, 2011 6:40 pm
by BiggBoss
nice bash skills