Author Topic: JTS3ServerMod Init.d Multi Script v1.16  (Read 52580 times)

AnimaTow

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Projekt OsUp
JTS3ServerMod Init.d Multi Script v1.16
« on: February 26, 2011, 10:51:41 PM »
Hihi

ich habe mir mal die arbeit gemacht ein Init.d Script zu Schreiben.
Mit Extra Funktionen, Updatecheck or Upgrade..

JTS3ServerMod Init.d Multi Tool Version 1.16

Beschreibung:

Das Init.d Script hat folgene Optionen..

/etc/init.d/jts3servermod start          ## Startet den Server.
/etc/init.d/jts3servermod stop           ## Stopt den Server.
/etc/init.d/jts3servermod restart        ## Restartet den Server
/etc/init.d/jts3servermod precheck       ## Checkt Kompatibilitaet des Servers.
/etc/init.d/jts3servermod jsupgrade      ## JTS3ServerMod Upgrade
/etc/init.d/jts3servermod jsuptdatecheck ## Checkt ob eine neue Version verfuegbar ist.
/etc/init.d/jts3servermod cronupgrade    ## Upgrade Cron Job fuer AutoUpdate Chack und Upgrade
/etc/init.d/jts3servermod scriptinfo     ## Informationen Über das Script

Installation:

Downloade das init.d Script

wget ftp://ftp.os-up.com/incoming/teamspeak3/JTS3ServerMod/init.d/jts3servermod -O /etc/init.d/jts3servermod
cd /etc/init.d/
chmod +x jts3servermod
update-rc.d jts3servermod defaults

Bitte beachtet das ihr erst die Optionen Bearbeitet bevor ihr den server startet!!

Bearbeite die Init Optionen in der datei /etc/init.d/jts3servermod
nano /etc/init.d/jts3servermod

## Optionen Start JTS3ServerMod
TITLE='JTS3ServerMod'                           # Name für den Server
DAEMONSCRIPT='JTS3ServerMod.jar'                # Bot Server Java Script
TS3BOT='/home/jts3servermod'                           # Ordner zum Teamspeak3 Bot
USER='jts3servermod'                                   # Benuter Start des Servers
USERG='jts3servermod'                                  # Benutergruppe Start des Servers
OPT=''                        # Script Start Optionen
JSOPT='-mx30M -jar'                             # Java Start Optionen
JAVASYSTEM='/usr/bin/java'                      # Java Path
LOGFILE='/var/log/jts3servermod.log'                   # Logfile location and file
## Optionen Ende JTS3ServerMod

Erstelle Log Datei
touch /var/log/jts3servermod.log

Die Upgrade funkion ist noch beta ich werde die tage nochmal dran arbeiten und mal schauen was man besser machen kann....

sollte jemand verbesserungs vorschlege haben würde ich mich sehr drüber freuen


Souce Code v1.16
Code: [Select]

#!/bin/sh
## JTS3ServerMod Inet.d Master Script v1.16 by Projekt OsUp www.os-up.com
## Optionen Start JTS3ServerMod
TITLE='JTS3ServerMod'                           # Name für den Server
DAEMONSCRIPT='JTS3ServerMod.jar'                # Bot Server Java Script
JTS3PATH='/home/ts3bot'                         # Ordner zum Teamspeak3 Bot
USER='ts3bot'                                   # Benuter Start des Servers
USERG='ts3bot'                                  # Benutergruppe Start des Servers
OPT=''       # Script Start Optionen
JSOPT='-mx30M -jar'                             # Java Start Optionen
JAVASYSTEM='/usr/bin/java'                      # Java Path
LOGFILE='/var/log/jts3servermode.log'           # Logfile location and file
## Optionen Ende JTS3ServerMod

## Optionen Start Upgrade
QUELLE_UPGRADETYPE='stable'
QUELLE_JTS3ServerMod='ftp://ftp.os-up.com:21/incoming/teamspeak3/JTS3ServerMod/JTS3ServerMod.version'
#QUELLE_JTS3ServerMod='http://home.arcor.de/stefan-1983/projects/JTS3ServerMod.version'
## Optionen Start Upgrade

## Ab hier Nichts mehr ändern ##
precheck () {
# Check ob sudo Vorhanden ist
if [ ! -x /usr/bin/sudo ]; then
  echo ""
  echo "Sudo ist nicht installert. Bitte Installiere Sudo und versuch es nochmal."
  echo "$(date +"%b %a %d  %H:%M:%S"): You do not have Sudo installed." >> $LOGFILE
  echo ""
  exit 1
fi

# Checking for awk
if [ ! -x /usr/bin/awk ]; then
  echo ""
  echo "Awk ist nicht installert. Bitte Installiere Awk und versuch es nochmal."
  echo "$(date +"%b %a %d  %H:%M:%S"): You do not have awk installed." >> $LOGFILE
  echo ""
  exit 1
fi

# Checking for java
if [ ! -x $JAVASYSTEM ]; then
  echo ""
  echo "Java ist nicht installert. Bitte Installiere Java und versuch es nochmal."
  echo "$(date +"%b %a %d  %H:%M:%S"): You do not have java installed." >> $LOGFILE
  echo ""
  exit 1
fi

# Checking for JTS3ServerMod
if [ ! -f $JTS3PATH/$DAEMONSCRIPT ]; then
  echo ""
  echo "Das Java datei ist nicht vorhanden : $JTS3PATH/$DAEMONSCRIPT ?/"
  echo "Ist die Config richtig Eingestellt?"
  echo "$(date +"%b %a %d  %H:%M:%S"): Can't find /" >> $LOGFILE
  exit 1
fi
echo
echo "Alles OK"
echo "Sie können den server Starten mit."
echo "/etc/init.d/jts3servermod start"
echo
}

service_start() {
TEST=$(ps ax | grep $DAEMONSCRIPT | grep -v export | grep -v grep | wc -l)

# Server ist nicht gestartet Pid datei ist aber vorhanden
if [ "$TEST" = "0" ] && [ ! -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "Starting $TITLE"
  echo "$(date +"%b %a %d  %H:%M:%S"): Starting $TITLE" >> $LOGFILE
  cd $JTS3PATH
  su $USER -c "$JAVASYSTEM $JSOPT $DAEMONSCRIPT $OPT" >> $LOGFILE 2>&1 &
  sleep 1
  sudo -u $USER ps ax | grep -v grep | grep $DAEMONSCRIPT | grep -v export | awk '{print $1}' > $JTS3PATH/JTS3ServerMod.pid
  chown $USER:$USERG $JTS3PATH/JTS3ServerMod.pid
  echo "$TITLE Process ID gespeichert in $JTS3PATH/JTS3ServerMod.pid"
  echo "$TITLE started."
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE started" >> $LOGFILE
  echo
  exit 1
fi

# Server ist nicht gestartet Pid datei ist Nicht vorhanden
if [ "$TEST" = "0" ] && [ -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "Server not running but pid-file present"
  echo "Loesche Pid Datei"
  echo "$(date +"%b %a %d  %H:%M:%S"): Server ist nicht gestartet Pid datei ist Nicht vorhanden" >> $LOGFILE
  echo "$(date +"%b %a %d  %H:%M:%S"): Removing pid-file" >> $LOGFILE
  rm $JTS3PATH/JTS3ServerMod.pid
  echo "Old pid file removed"
  echo "$(date +"%b %a %d  %H:%M:%S"): Old pid file removed" >> $LOGFILE
  echo
  echo "Starting $TITLE"
  echo "$(date +"%b %a %d  %H:%M:%S"): Starting $TITLE" >> $LOGFILE
  cd $JTS3PATH
  su $USER -c "$JAVASYSTEM $JSOPT $DAEMONSCRIPT $OPT" >> $LOGFILE 2>&1 &
  sleep 1
  sudo -u $USER ps ax | grep -v grep | grep $DAEMONSCRIPT | grep -v export | grep -v export | awk '{print $1}' > $JTS3PATH/JTS3ServerMod.pid
  chown $USER:$USERG $JTS3PATH/JTS3ServerMod.pid
  echo "$TITLE screen process ID written to $JTS3PATH/JTS3ServerMod.pid"
  echo "$TITLE started."
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE started" >> $LOGFILE
  echo
fi

# Server running and no pid file-found, creates a new one!
if [ "$TEST" = "1" ] && [ ! -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "Server is running but no pid file. Creating a new pid file!!"
  echo "$(date +"%b %a %d  %H:%M:%S"): Server is running but no pid file. Creating a new pid file!!" >> $LOGFILE
  sudo -u $USER ps ax | grep -v grep | grep $DAEMONSCRIPT | grep -v export | awk '{print $1'} > $JTS3PATH/JTS3ServerMod.pid
  chown $USER:$USERG $JTS3PATH/JTS3ServerMod.pid
  echo
  echo "$TITLE is running and new pid-file created"
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE is running and new pid-file created" >> $LOGFILE
  echo
fi

# Server ist gestartet und Pid Datei wurde gefunden.
if [ "$TEST" = "1" ] && [ -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "$TITLE Gestartet!!"
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE Gestartet!!" >> $LOGFILE
  echo
fi
}

service_stop() {
TEST1=$(ps ax | grep -v grep | grep $DAEMONSCRIPT | grep -v export | wc -l)

# Server is not running and no pid-file found
if [ "$TEST1" = "0" ] && [ ! -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "$TITLE is not running!!"
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE is not running!!" >> $LOGFILE
  echo
fi

# Server is not running and pid-file found
if [ "$TEST1" = "0" ] && [ -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "Server is not running but pid-file is present"
  echo "Removing pid-file"
  echo "$(date +"%b %a %d  %H:%M:%S"): Server is not running but pid-file is present" >> $LOGFILE
  echo "$(date +"%b %a %d  %H:%M:%S"): Removing pid-file" >> $LOGFILE
  rm $JTS3PATH/JTS3ServerMod.pid
  echo
  echo "Pid Datei Geloescht."
  echo "$(date +"%b %a %d  %H:%M:%S"): Pid file removed" >> $LOGFILE
  echo
fi

# Server is running but no pid-file found
if [ "$TEST1" = "2" ] && [ ! -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "$TITLE is running but no pid file found."
  echo "Stopping $TITLE"
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE is running but no pid file found." >> $LOGFILE
  echo "$(date +"%b %a %d  %H:%M:%S"): Stopping $TITLE" >> $LOGFILE
  sudo -u $USER ps ax | grep -v grep | grep $DAEMONSCRIPT | grep -v export | awk '{print $1'} > $JTS3PATH/JTS3ServerMod.pid
  chown $USER:$USERG $JTS3PATH/JTS3ServerMod.pid
  for id in $(sed -n '1p' $JTS3PATH/JTS3ServerMod.pid)
  do
kill -TERM $id
  echo "Killing process ID $id"
  echo "Removing $TITLE pid file"
  rm -rf $JTS3PATH/JTS3ServerMod.pid
  break
  done
  echo "$TITLE stopped"
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE stopped" >> $LOGFILE
  echo
fi

# Server running and pid-file found
if [ "$TEST1" = "2" ] && [ -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "Stopping $TITLE"
  echo "$(date +"%b %a %d  %H:%M:%S"): Stopping $TITLE" >> $LOGFILE
  for id in $(sed -n '1p' $JTS3PATH/JTS3ServerMod.pid)
  do
kill -TERM $id
  echo "Beende Prozess ID: $id"
  echo "Loesche $JTS3PATH/JTS3ServerMod.pid"
  rm -rf $JTS3PATH/JTS3ServerMod.pid
  break
  done
  echo "$TITLE Beendet"
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE Beendet" >> $LOGFILE
  echo
fi
}

jsupgrade () {
echo
echo "JTS3ServerMod Upgrade ....."
echo

if [ $QUELLE_UPGRADETYPE == 'stable' ]
    then
echo "stable"
wget $QUELLE_JTS3ServerMod -O $JTS3PATH/.jsversionquelle
UPGRADEQUELLE=$(sed -n '1p' $JTS3PATH/.jsversionquelle)

rm $JTS3PATH/.jsupgradeurl
rm $JTS3PATH/.jsupgradeversion
rm $JTS3PATH/.jsupgradetype
rm $JTS3PATH/.jsupgradedateiname

echo $(echo $(echo $UPGRADEQUELLE | awk 'BEGIN {FS = ";"} {print $3}') | tr -d "[:space:]" > $JTS3PATH/.jsupgradeurl )
echo $(echo $(echo $UPGRADEQUELLE | awk 'BEGIN {FS = ";"} {print $2}') > $JTS3PATH/.jsupgradeversion )
echo $(echo $(echo $UPGRADEQUELLE | awk 'BEGIN {FS = ";"} {print $1}') | tr -d "[:space:]" > $JTS3PATH/.jsupgradetype )
echo $(echo JTS3ServerMod_$(cat $JTS3PATH/.jsupgradeurl | awk 'BEGIN {FS = "/JTS3ServerMod_"} {print $2}') | tr -d "[:space:]" > $JTS3PATH/.jsupgradedateiname )

  elif [ $QUELLE_UPGRADETYPE == 'beta' ]
    then
echo "beta"
wget $QUELLE_JTS3ServerMod -O $JTS3PATH/.jsversionquelle
UPGRADEQUELLE=$(sed -n '2p' $JTS3PATH/.jsversionquelle)

rm $JTS3PATH/.jsupgradeurl
rm $JTS3PATH/.jsupgradeversion
rm $JTS3PATH/.jsupgradetype
rm $JTS3PATH/.jsupgradedateiname

echo $(echo $(echo $UPGRADEQUELLE | awk 'BEGIN {FS = ";"} {print $3}') | tr -d "[:space:]" > $JTS3PATH/.jsupgradeurl )
echo $(echo $(echo $UPGRADEQUELLE | awk 'BEGIN {FS = ";"} {print $2}') > $JTS3PATH/.jsupgradeversion )
echo $(echo $(echo $UPGRADEQUELLE | awk 'BEGIN {FS = ";"} {print $1}') | tr -d "[:space:]" > $JTS3PATH/.jsupgradetype )
echo $(echo $(cat $JTS3PATH/.jsupgradeurl | awk 'BEGIN {FS = "/JTS3ServerMod_"} {print $2}') | tr -d "[:space:]" > $JTS3PATH/.jsupgradedateiname )

  else
echo "Fehlerhafte Upgrade versions angabe in der Configuration."
fi


if [ "$(cat $JTS3PATH/.jsupgradeversion)" == "$(cat $JTS3PATH/.jsversion)" ]
then
echo "Sie haben bereits die Neuste Version Installiert.."
echo "###################################"
echo "##"
echo "##"
echo "Locale JTS3ServerMod.jar Version: $(cat $JTS3PATH/.jsversion)"
echo "Quelle JTS3ServerMod.jar Version: $(cat $JTS3PATH/.jsupgradeversion)"
echo "##"
echo "##"
echo "###################################"
else
echo "Upgrade wert Vorberietet.."
echo "###################################"
echo "##"
echo "JTS3ServerMod Stop"
        service_stop
        sleep 5
echo "##"
echo "###################################"

echo "Erstelle Temp Verzeichniss.."
echo "###################################"
echo "##"
mkdir $JTS3PATH/temp/
echo "##"
echo "###################################"

echo "Downloade Upgrade....."
echo "###################################"
echo "##"
cd $JTS3PATH/temp/
wget $(sed 'N;s/-\n//;P;D;' $JTS3PATH/.jsupgradeurl | tr -d "[:space:]")
echo "##"
echo "###################################"

echo "Entpacke JTS3ServerMod.jar....."
echo "###################################"
echo "##"
unzip -d $JTS3PATH/temp $(cat $JTS3PATH/.jsupgradedateiname) JTS3ServerMod/JTS3ServerMod.jar
echo "##"
echo "###################################"

echo "Überschreibe JTS3ServerMod.jar....."
echo "###################################"
echo "##"
cp $JTS3PATH/temp/JTS3ServerMod/JTS3ServerMod.jar $JTS3PATH/JTS3ServerMod.jar
chown $USER:$USERG $JTS3PATH/JTS3ServerMod.jar
echo "##"
echo "###################################"

echo "Lösche Temp Dateien....."
echo "###################################"
echo "##"
cd $JTS3PATH/
rm -rf $JTS3PATH/temp/
echo "##"
echo "###################################"

echo "Aktualesiere Locale Verions Informationen....."
echo "###################################"
echo "##"
rm $JTS3PATH/.jsversion
echo $(cat $JTS3PATH/.jsupgradeversion) >> $JTS3PATH/.jsversion
chown $USER:$USERG $JTS3PATH/.jsversion
echo "##"
echo "###################################"

echo "JTS3ServerMod wurde aktualesiert."
echo "###################################"
echo "##"
echo "Aktuele JTS3ServerMod.jar Version:"
echo $(cat $JTS3PATH/.jsversion)
echo "##"
echo "###################################"

echo "Info.."
echo "###################################"
echo "##"
echo "Starten die den Server Neu"
echo "/etc/init.d/jts3servermod start"
echo "##"
echo "###################################"
fi
}

jsuptdatecheck () {
echo
echo "Check Update..."
if [ ! -f $JTS3PATH/.jsversion ]; then
  echo ""
  echo "Versions Check Fehler: die datei $JTS3PATH/.jsversion ist nicht vorhanden.. /n bitte Upgrade damit die datei angelegt wert. "
  echo "$(date +"%b %a %d  %H:%M:%S"): Versions Check Fehler: die datei $JTS3PATH/.jsversion ist nicht vorhanden.. /n bitte Upgrade damit die datei angelegt wert.  /" >> $LOGFILE
  exit 1
fi

if [ $QUELLE_UPGRADETYPE == 'stable' ]
    then
echo "stable"
wget $QUELLE_JTS3ServerMod -O $JTS3PATH/.jsversionquelle
export UPGRADEQUELLE=$(sed -n '1p' $JTS3PATH/.jsversionquelle)
export UPGRADEQUELLEVERSION=$(echo $UPGRADEQUELLESTABLE | awk 'BEGIN {FS = ";"} {print $2}')
  elif [ $QUELLE_UPGRADETYPE == 'beta' ]
    then
echo "beta"
wget $QUELLE_JTS3ServerMod -O $JTS3PATH/.jsversionquelle
export UPGRADEQUELLE=$(sed -n '2p' $JTS3PATH/.jsversionquelle)
export UPGRADEQUELLEVERSION=$(echo $UPGRADEQUELLEBETA | awk 'BEGIN {FS = ";"} {print $2}')
  else
echo "Fehlerhafte Upgrade version"
fi

if [ "$(cat $JTS3PATH/.jsupgradeversion)" == "$(cat $JTS3PATH/.jsversion)" ]
then
echo Sie haben die Neuste version.
else
echo
echo "Es ist eine Neues Update verfuegbar."
echo "Sie Koennen jetzt ein Upgade Starten."
echo "###################################"
echo "##"
echo "##"
echo "Locale JTS3ServerMod.jar Version: $(cat $JTS3PATH/.jsversion)"
echo "Quelle JTS3ServerMod.jar Version: $(cat $JTS3PATH/.jsupgradeversion)"
echo "##"
echo "##"
echo "###################################"
echo "/etc/init.d/jts3servermod jsupgrade"
echo
fi

}

scriptinfo () {
echo
echo "JTS3ServerMod Multi Init.d Script ....."
echo
echo "Programmierer: AnimaTow (Stephan Broeker)"
       echo "Website: http://www.os-up.com"
echo
echo "JTS3ServerMod Projekt"
echo "Programmierer: Stefan1200"
echo "Website: http://stefan1200.bplaced.net/"
       echo "Download Seite http://addons.teamspeak.com/"
echo
}

cronupgrade () {
  echo "$(date +"%b %a %d  %H:%M:%S"): Cron Job Upgrade Start." >> $LOGFILE
wget $QUELLE_JTS3ServerMod/.jsversion -O $JTS3PATH/.jsversionquelle
export JSVERSIONQUELLE=$(cat $JTS3PATH/.jsversionquelle)
    export JSVERSIONLOCAL=$(cat $JTS3PATH/.jsversion)
  echo "$(date +"%b %a %d  %H:%M:%S"): Quellen Version: $JSVERSIONQUELLE" >> $LOGFILE
  echo "$(date +"%b %a %d  %H:%M:%S"): Locale Version: $JSVERSIONLOCAL" >> $LOGFILE
    if [ "$JSVERSIONLOCAL" == "$JSVERSIONQUELLE" ]
    then
      echo "$(date +"%b %a %d  %H:%M:%S"): Cron Job Upgrade Neuste Version Vohanden." >> $LOGFILE
    else
        service_stop
        sleep 5
    wget $QUELLE_JTS3ServerMod/JTS3ServerMod.jar -O $JTS3PATH/JTS3ServerMod.jar
    wget $QUELLE_JTS3ServerMod/.jsversion -O $JTS3PATH/.jsversion
    service_start
      echo "$(date +"%b %a %d  %H:%M:%S"): Cron Job Upgrade auf Neuste Version: $JSVERSIONQUELLE Geupdatet." >> $LOGFILE
    fi
}

case "$1" in
    'start')
        service_start
    ;;
    'stop')
        service_stop
    ;;
    'restart')
        service_stop
        sleep 5
        service_start
    ;;
    'precheck')
        precheck
    ;;
    'jsupgrade')
        jsupgrade
    ;;
    'jsuptdatecheck')
        jsuptdatecheck
    ;;
    'scriptinfo')
        scriptinfo
    ;;
    'cronupgrade')
        cronupgrade
    ;;
*)
        echo "/etc/init.d/jts3servermod start          ## Startet den Server."
        echo "/etc/init.d/jts3servermod stop           ## Stopt den Server."
        echo "/etc/init.d/jts3servermod restart        ## Restartet den Server"
        echo "/etc/init.d/jts3servermod precheck       ## Checkt Kompatibilitaet des Servers."
        echo "/etc/init.d/jts3servermod jsupgrade      ## JTS3ServerMod Upgradet"
        echo "/etc/init.d/jts3servermod jsuptdatecheck ## Ceckt ob eine neue Version verfuegbar ist."
        echo "/etc/init.d/jts3servermod cronupgrade    ## Upgrade Cron Job fue AutoUpdate Chack und Upgrade"
        echo "/etc/init.d/jts3servermod scriptinfo     ## Informationen Über das Script"
esac





in der neuen version 1.16 habe ich die upgrade funktion überarbeitet....


Liebe Grüße und viel Spass....

AnimaTow

Update: 28.2.2011 12:00
« Last Edit: February 28, 2011, 09:34:56 PM by AnimaTow »

Stefan1200

  • Administrator
  • *****
  • Posts: 2244
    • View Profile
Re: JTS3ServerMod Init.d Multi Script
« Reply #1 on: February 26, 2011, 11:11:05 PM »
Sieht sehr interessant aus.

Btw. in der vorletzten Zeile, die Usage, sollte das nicht so sein?
Code: [Select]
echo "Usage ./jts3servermod start|stop|restart|precheck|scriptinfo"
Außerdem war ich interessiert, wie du jsupgrade und jsuptdatecheck realisiert hast, habe es aber nicht im Skript gefunden. Habe ich was übersehen?

Edit: Habe jetzt erst gelesen, das du an der upgrade Geschichte noch arbeitest.
« Last Edit: February 26, 2011, 11:14:15 PM by Stefan1200 »

AnimaTow

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Projekt OsUp
Re: JTS3ServerMod Init.d Multi Script
« Reply #2 on: February 26, 2011, 11:20:01 PM »
hehe

Quote
echo "Usage ./jts3servermod start|stop|restart|precheck|scriptinfo"
An sich hast du schon recht nur habe ich infos mit eingrbaut


Code: [Select]
server8:/home/ts3bot# /etc/init.d/jts3servermod
/etc/init.d/jts3servermod start          ## Startet den Server.
/etc/init.d/jts3servermod stop           ## Stopt den Server.
/etc/init.d/jts3servermod restart        ## Restartet den Server
/etc/init.d/jts3servermod precheck       ## Checkt Kompatibilitaet des Servers.
/etc/init.d/jts3servermod jsupgrade      ## JTS3ServerMod Upgradet
/etc/init.d/jts3servermod jsuptdatecheck ## Ceckt ob eine neue Version verfuegbar ist.
/etc/init.d/jts3servermod cronupgrade    ## Upgrade Cron Job fue AutoUpdate Chack und Upgrade
/etc/init.d/jts3servermod scriptinfo     ## Informationen Über das Script

ist zwar nicht üblich aber es geht auch so ;)))


den zur upgrade version da hatte ich mir auch lange ein kopf gemacht und habe es bis jetzt so gelöst das ich ein Update Verzeichniss erstellt habe auf meinem ftp Server und habe eine .jsversion abgelegt wo die aktuelle version des servermods drin steht...

es ist warscheinlich auch verbesserungs bedürftig aber es geht..

hier nochmal den code auszug des upgrades

Code: [Select]
jsupgrade () {
echo
echo "JTS3ServerMod Upgrade ....."
echo
echo "Server Stopen"
       service_stop
       sleep 5
wget $QUELLE_JTS3ServerMod/JTS3ServerMod.jar -O $TS3BOT/JTS3ServerMod.jar
wget $QUELLE_JTS3ServerMod/.jsversion -O $TS3BOT/.jsversion
echo
echo
echo "JTS3ServerMod wurde aktualesiert."
echo
echo "Server Starten"
service_start
echo
}

jsuptdatecheck () {
echo
echo "Check Update..."
if [ ! -f $TS3BOT/.jsversion ]; then
  echo ""
  echo "Versions Check Fehler: die datei $TS3BOT/.jsversion ist nicht vorhanden.. /n bitte Upgrade damit die datei angelegt wert. "
  echo "$(date +"%b %a %d  %H:%M:%S"): Versions Check Fehler: die datei $TS3BOT/.jsversion ist nicht vorhanden.. /n bitte Upgrade damit die datei angelegt wert.  /" >> $LOGFILE
  exit 1
fi
for jsversion_local in $(sed -n '1p' $TS3BOT/.jsversion)
do
wget $QUELLE_JTS3ServerMod/.jsversion -O $TS3BOT/.jsversionquelle
export JAVAVERSIONQUELLE=$(cat $TS3BOT/.jsversionquelle)

echo "Locale JTS3ServerMod.jar Version: $jsversion_local"
echo "Quelle JTS3ServerMod.jar Version: $JAVAVERSIONQUELLE"

if [ "$jsversion_local" == "$JAVAVERSIONQUELLE" ]
then
echo Sie haben die Neuste version.
else
echo
echo "Es ist eine Neues Update verfuegbar."
echo "Sie Koennen jetzt ein Upgade Starten."
echo "##"
echo "./jts3servermod jsupgrade"
echo
fi
break
done
}


Edit:

ich werde morgen mal die upgrade funktion erweitern, wollte auch eigentlich noch eine compitter funktion mit einbauen das würde ich auch noch cool finden ;) mal schauen was mir noch so durch den kopf geht...
« Last Edit: February 26, 2011, 11:28:10 PM by AnimaTow »

Stefan1200

  • Administrator
  • *****
  • Posts: 2244
    • View Profile
Re: JTS3ServerMod Init.d Multi Script
« Reply #3 on: February 26, 2011, 11:26:05 PM »
Quote
echo "Usage ./jts3servermod start|stop|restart|precheck|scriptinfo"
An sich hast du schon recht nur habe ich infos mit eingrbaut

Sorry, war nicht deutlich genug:
Ich meine diese Datei: ftp://ftp.os-up.com/incoming/teamspeak3/JTS3ServerMod/init.d/jts3servermod

Aktuell:
Code: [Select]
echo "Usage ./teamspeak3 start|stop|restart|precheck|scriptinfo"
Ist das gemeint?:
Code: [Select]
echo "Usage ./jts3servermod start|stop|restart|precheck|scriptinfo"
Aber habe jetzt erst gesehen, das dies eh eine andere Version ist, als die im Forum stehende.

Zur Update Prüfung:
Der Bot selbst nutzt diese Datei: http://home.arcor.de/stefan-1983/projects/JTS3ServerMod.version
Vielleicht kannst du damit was anfangen.

Edit:
Ich könnte natürlich mal ein Startargument beim Bot hinzufügen, das die selbe Ausgabe zurück gibt, wie der Chat Befehl !botversion
« Last Edit: February 26, 2011, 11:30:57 PM by Stefan1200 »

AnimaTow

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Projekt OsUp
Re: JTS3ServerMod Init.d Multi Script
« Reply #4 on: February 26, 2011, 11:31:44 PM »
ahhh jo mein fehler habe da noch alte drin gehabt lol hehe

habe ich gleich mal gefixt !!!

lach ;)

Edit:

Mit der Versions abfrage das werde ich mal überarbeiten..

werde das mal bis morgen in angriff nehmen bringt mir grade spass ;)
« Last Edit: February 26, 2011, 11:38:38 PM by AnimaTow »

Stefan1200

  • Administrator
  • *****
  • Posts: 2244
    • View Profile
Re: JTS3ServerMod Init.d Multi Script
« Reply #5 on: February 26, 2011, 11:41:27 PM »
@ AnimaTow: Hatte meinen letzten Beitrag noch bearbeitet, nach dem du angefangen hast die Antwort zu schreiben. Hattest noch gelesen?
Weiß zwar nicht ob dir das weiterhilft, aber wer weiß :).

AnimaTow

  • Newbie
  • *
  • Posts: 4
    • View Profile
    • Projekt OsUp
Re: JTS3ServerMod Init.d Multi Script v1.16
« Reply #6 on: February 28, 2011, 12:48:12 PM »
So ich habe die version 1.16 Online gestellt..

Updates
Upgrade funktion überarbeitet...
Kleinere Fixes

todo:
Überarbeitung des Cronjobs.
Überarbeitung Installations Anleitung.
JTS3ServerMod Install Helper

Neue Source im ersten beitrag !!!

Liebe Grüße
AnimaTow
« Last Edit: February 28, 2011, 01:12:34 PM by AnimaTow »

Nogi19

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: JTS3ServerMod Init.d Multi Script v1.16
« Reply #7 on: April 22, 2011, 08:16:12 AM »
Hallo, habe dam mal ein kleines Problem
habe alles nach Anleitung gemacht sämtliche settings stimmen auch
jedoch bekomme ich einen fehler wenn ich das script ausführen möchte und zwar folgenden :

Führe /etc/init.d/jts3servermod start aus ...


/bin/sh: /etc/init.d/jts3servermod: /bin/sh^M: bad interpreter: No such file or directory


woran kann das liegen ?
Bitte um Hilfe

Stefan1200

  • Administrator
  • *****
  • Posts: 2244
    • View Profile
Re: JTS3ServerMod Init.d Multi Script v1.16
« Reply #8 on: April 22, 2011, 04:25:14 PM »
/bin/sh: /etc/init.d/jts3servermod: /bin/sh^M: bad interpreter: No such file or directory

Linux Shellskripte müssen die Linux Zeilenenden haben, sonst führt der zusätzliche Wagenrücklauf am Ende jeder Zeile einer Windows Textdatei zu Problemen.

D.h. mit einem guten Texteditor wie Notepad++ im Menü Bearbeiten -> Zeilenende -> UNIX aktivieren, abspeichern und neu hochladen.

Nogi19

  • Newbie
  • *
  • Posts: 2
    • View Profile
Re: JTS3ServerMod Init.d Multi Script v1.16
« Reply #9 on: April 22, 2011, 06:08:56 PM »
jetzt habe ich das Problem das ich mit dem befehl:

/etc/init.d/jts3servermod start

den bot starten möchte jedoch tut er dieses nicht und gibt mir auch keinen fehler

wenn ich ihn manuell starte über den standart starbefehl dann geht er jedoch
also der bot läuft, aber nicht über das init.d script

Stefan1200

  • Administrator
  • *****
  • Posts: 2244
    • View Profile
Re: JTS3ServerMod Init.d Multi Script v1.16
« Reply #10 on: April 22, 2011, 06:34:11 PM »
jetzt habe ich das Problem das ich mit dem befehl:

/etc/init.d/jts3servermod start

den bot starten möchte jedoch tut er dieses nicht und gibt mir auch keinen fehler

Da kann leider nur AnimaTow helfen, da ich das Skript selbst nicht nutze.

Christoph Herthel

  • JTS3ServerMod Internal
  • *****
  • Posts: 19
    • View Profile
    • Me, myself and I
Re: JTS3ServerMod Init.d Multi Script v1.16
« Reply #11 on: June 12, 2014, 12:01:57 AM »
Hat noch irgendjemand das Autostart Script?

Speddyroot

  • JTS3ServerMod Internal
  • *****
  • Posts: 12
    • View Profile
Re: JTS3ServerMod Init.d Multi Script v1.16
« Reply #12 on: August 29, 2014, 11:03:15 PM »
währ einer mal so nett und könnte einer das Script noch mal hoch laden.

SkullDrago

  • JTS3ServerMod Internal
  • *****
  • Posts: 59
    • View Profile
Re: JTS3ServerMod Init.d Multi Script v1.16
« Reply #13 on: October 22, 2014, 11:18:38 PM »
Code: [Select]
#!/bin/sh
## JTS3ServerMod Inet.d Master Script v1.16 by Projekt OsUp www.os-up.com
## Optionen Start JTS3ServerMod
TITLE='JTS3ServerMod'                           # Name für den Server
DAEMONSCRIPT='JTS3ServerMod.jar'                # Bot Server Java Script
JTS3PATH='/opt/JTS3web'                         # Ordner zum Teamspeak3 Bot
USER='root'                                   # Benuter Start des Servers
USERG='root'                                  # Benutergruppe Start des Servers
OPT=''       # Script Start Optionen
JSOPT='-mx30M -jar'                             # Java Start Optionen
JAVASYSTEM='/usr/bin/java'                      # Java Path
LOGFILE='/var/log/jts3servermode.log'           # Logfile location and file
## Optionen Ende JTS3ServerMod

## Optionen Start Upgrade
QUELLE_UPGRADETYPE='stable'
QUELLE_JTS3ServerMod='ftp://ftp.os-up.com:21/incoming/teamspeak3/JTS3ServerMod/JTS3ServerMod.version'
#QUELLE_JTS3ServerMod='http://home.arcor.de/stefan-1983/projects/JTS3ServerMod.version'
## Optionen Start Upgrade

## Ab hier Nichts mehr ändern ##
precheck () {
# Check ob sudo Vorhanden ist
if [ ! -x /usr/bin/sudo ]; then
  echo ""
  echo "Sudo ist nicht installert. Bitte Installiere Sudo und versuch es nochmal."
  echo "$(date +"%b %a %d  %H:%M:%S"): You do not have Sudo installed." >> $LOGFILE
  echo ""
  exit 1
fi

# Checking for awk
if [ ! -x /usr/bin/awk ]; then
  echo ""
  echo "Awk ist nicht installert. Bitte Installiere Awk und versuch es nochmal."
  echo "$(date +"%b %a %d  %H:%M:%S"): You do not have awk installed." >> $LOGFILE
  echo ""
  exit 1
fi

# Checking for java
if [ ! -x $JAVASYSTEM ]; then
  echo ""
  echo "Java ist nicht installert. Bitte Installiere Java und versuch es nochmal."
  echo "$(date +"%b %a %d  %H:%M:%S"): You do not have java installed." >> $LOGFILE
  echo ""
  exit 1
fi

# Checking for JTS3ServerMod
if [ ! -f $JTS3PATH/$DAEMONSCRIPT ]; then
  echo ""
  echo "Das Java datei ist nicht vorhanden : $JTS3PATH/$DAEMONSCRIPT ?/"
  echo "Ist die Config richtig Eingestellt?"
  echo "$(date +"%b %a %d  %H:%M:%S"): Can't find /" >> $LOGFILE
  exit 1
fi
echo
echo "Alles OK"
echo "Sie können den server Starten mit."
echo "/etc/init.d/jts3servermod start"
echo
}

service_start() {
TEST=$(ps ax | grep $DAEMONSCRIPT | grep -v export | grep -v grep | wc -l)

# Server ist nicht gestartet Pid datei ist aber vorhanden
if [ "$TEST" = "0" ] && [ ! -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "Starting $TITLE"
  echo "$(date +"%b %a %d  %H:%M:%S"): Starting $TITLE" >> $LOGFILE
  cd $JTS3PATH
  su $USER -c "$JAVASYSTEM $JSOPT $DAEMONSCRIPT $OPT" >> $LOGFILE 2>&1 &
  sleep 1
  sudo -u $USER ps ax | grep -v grep | grep $DAEMONSCRIPT | grep -v export | awk '{print $1}' > $JTS3PATH/JTS3ServerMod.pid
  chown $USER:$USERG $JTS3PATH/JTS3ServerMod.pid
  echo "$TITLE Process ID gespeichert in $JTS3PATH/JTS3ServerMod.pid"
  echo "$TITLE started."
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE started" >> $LOGFILE
  echo
  exit 1
fi

# Server ist nicht gestartet Pid datei ist Nicht vorhanden
if [ "$TEST" = "0" ] && [ -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "Server not running but pid-file present"
  echo "Loesche Pid Datei"
  echo "$(date +"%b %a %d  %H:%M:%S"): Server ist nicht gestartet Pid datei ist Nicht vorhanden" >> $LOGFILE
  echo "$(date +"%b %a %d  %H:%M:%S"): Removing pid-file" >> $LOGFILE
  rm $JTS3PATH/JTS3ServerMod.pid
  echo "Old pid file removed"
  echo "$(date +"%b %a %d  %H:%M:%S"): Old pid file removed" >> $LOGFILE
  echo
  echo "Starting $TITLE"
  echo "$(date +"%b %a %d  %H:%M:%S"): Starting $TITLE" >> $LOGFILE
  cd $JTS3PATH
  su $USER -c "$JAVASYSTEM $JSOPT $DAEMONSCRIPT $OPT" >> $LOGFILE 2>&1 &
  sleep 1
  sudo -u $USER ps ax | grep -v grep | grep $DAEMONSCRIPT | grep -v export | grep -v export | awk '{print $1}' > $JTS3PATH/JTS3ServerMod.pid
  chown $USER:$USERG $JTS3PATH/JTS3ServerMod.pid
  echo "$TITLE screen process ID written to $JTS3PATH/JTS3ServerMod.pid"
  echo "$TITLE started."
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE started" >> $LOGFILE
  echo
fi

# Server running and no pid file-found, creates a new one!
if [ "$TEST" = "1" ] && [ ! -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "Server is running but no pid file. Creating a new pid file!!"
  echo "$(date +"%b %a %d  %H:%M:%S"): Server is running but no pid file. Creating a new pid file!!" >> $LOGFILE
  sudo -u $USER ps ax | grep -v grep | grep $DAEMONSCRIPT | grep -v export | awk '{print $1'} > $JTS3PATH/JTS3ServerMod.pid
  chown $USER:$USERG $JTS3PATH/JTS3ServerMod.pid
  echo
  echo "$TITLE is running and new pid-file created"
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE is running and new pid-file created" >> $LOGFILE
  echo
fi

# Server ist gestartet und Pid Datei wurde gefunden.
if [ "$TEST" = "1" ] && [ -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "$TITLE Gestartet!!"
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE Gestartet!!" >> $LOGFILE
  echo
fi
}

service_stop() {
TEST1=$(ps ax | grep -v grep | grep $DAEMONSCRIPT | grep -v export | wc -l)

# Server is not running and no pid-file found
if [ "$TEST1" = "0" ] && [ ! -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "$TITLE is not running!!"
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE is not running!!" >> $LOGFILE
  echo
fi

# Server is not running and pid-file found
if [ "$TEST1" = "0" ] && [ -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "Server is not running but pid-file is present"
  echo "Removing pid-file"
  echo "$(date +"%b %a %d  %H:%M:%S"): Server is not running but pid-file is present" >> $LOGFILE
  echo "$(date +"%b %a %d  %H:%M:%S"): Removing pid-file" >> $LOGFILE
  rm $JTS3PATH/JTS3ServerMod.pid
  echo
  echo "Pid Datei Geloescht."
  echo "$(date +"%b %a %d  %H:%M:%S"): Pid file removed" >> $LOGFILE
  echo
fi

# Server is running but no pid-file found
if [ "$TEST1" = "2" ] && [ ! -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "$TITLE is running but no pid file found."
  echo "Stopping $TITLE"
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE is running but no pid file found." >> $LOGFILE
  echo "$(date +"%b %a %d  %H:%M:%S"): Stopping $TITLE" >> $LOGFILE
  sudo -u $USER ps ax | grep -v grep | grep $DAEMONSCRIPT | grep -v export | awk '{print $1'} > $JTS3PATH/JTS3ServerMod.pid
  chown $USER:$USERG $JTS3PATH/JTS3ServerMod.pid
  for id in $(sed -n '1p' $JTS3PATH/JTS3ServerMod.pid)
  do
kill -TERM $id
  echo "Killing process ID $id"
  echo "Removing $TITLE pid file"
  rm -rf $JTS3PATH/JTS3ServerMod.pid
  break
  done
  echo "$TITLE stopped"
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE stopped" >> $LOGFILE
  echo
fi

# Server running and pid-file found
if [ "$TEST1" = "2" ] && [ -f $JTS3PATH/JTS3ServerMod.pid ]; then
  echo
  echo "Stopping $TITLE"
  echo "$(date +"%b %a %d  %H:%M:%S"): Stopping $TITLE" >> $LOGFILE
  for id in $(sed -n '1p' $JTS3PATH/JTS3ServerMod.pid)
  do
kill -TERM $id
  echo "Beende Prozess ID: $id"
  echo "Loesche $JTS3PATH/JTS3ServerMod.pid"
  rm -rf $JTS3PATH/JTS3ServerMod.pid
  break
  done
  echo "$TITLE Beendet"
  echo "$(date +"%b %a %d  %H:%M:%S"): $TITLE Beendet" >> $LOGFILE
  echo
fi
}

jsupgrade () {
echo
echo "JTS3ServerMod Upgrade ....."
echo

if [ $QUELLE_UPGRADETYPE == 'stable' ]
    then
echo "stable"
wget $QUELLE_JTS3ServerMod -O $JTS3PATH/.jsversionquelle
UPGRADEQUELLE=$(sed -n '1p' $JTS3PATH/.jsversionquelle)

rm $JTS3PATH/.jsupgradeurl
rm $JTS3PATH/.jsupgradeversion
rm $JTS3PATH/.jsupgradetype
rm $JTS3PATH/.jsupgradedateiname

echo $(echo $(echo $UPGRADEQUELLE | awk 'BEGIN {FS = ";"} {print $3}') | tr -d "[:space:]" > $JTS3PATH/.jsupgradeurl )
echo $(echo $(echo $UPGRADEQUELLE | awk 'BEGIN {FS = ";"} {print $2}') > $JTS3PATH/.jsupgradeversion )
echo $(echo $(echo $UPGRADEQUELLE | awk 'BEGIN {FS = ";"} {print $1}') | tr -d "[:space:]" > $JTS3PATH/.jsupgradetype )
echo $(echo JTS3ServerMod_$(cat $JTS3PATH/.jsupgradeurl | awk 'BEGIN {FS = "/JTS3ServerMod_"} {print $2}') | tr -d "[:space:]" > $JTS3PATH/.jsupgradedateiname )

  elif [ $QUELLE_UPGRADETYPE == 'beta' ]
    then
echo "beta"
wget $QUELLE_JTS3ServerMod -O $JTS3PATH/.jsversionquelle
UPGRADEQUELLE=$(sed -n '2p' $JTS3PATH/.jsversionquelle)

rm $JTS3PATH/.jsupgradeurl
rm $JTS3PATH/.jsupgradeversion
rm $JTS3PATH/.jsupgradetype
rm $JTS3PATH/.jsupgradedateiname

echo $(echo $(echo $UPGRADEQUELLE | awk 'BEGIN {FS = ";"} {print $3}') | tr -d "[:space:]" > $JTS3PATH/.jsupgradeurl )
echo $(echo $(echo $UPGRADEQUELLE | awk 'BEGIN {FS = ";"} {print $2}') > $JTS3PATH/.jsupgradeversion )
echo $(echo $(echo $UPGRADEQUELLE | awk 'BEGIN {FS = ";"} {print $1}') | tr -d "[:space:]" > $JTS3PATH/.jsupgradetype )
echo $(echo $(cat $JTS3PATH/.jsupgradeurl | awk 'BEGIN {FS = "/JTS3ServerMod_"} {print $2}') | tr -d "[:space:]" > $JTS3PATH/.jsupgradedateiname )

  else
echo "Fehlerhafte Upgrade versions angabe in der Configuration."
fi


if [ "$(cat $JTS3PATH/.jsupgradeversion)" == "$(cat $JTS3PATH/.jsversion)" ]
then
echo "Sie haben bereits die Neuste Version Installiert.."
echo "###################################"
echo "##"
echo "##"
echo "Locale JTS3ServerMod.jar Version: $(cat $JTS3PATH/.jsversion)"
echo "Quelle JTS3ServerMod.jar Version: $(cat $JTS3PATH/.jsupgradeversion)"
echo "##"
echo "##"
echo "###################################"
else
echo "Upgrade wert Vorberietet.."
echo "###################################"
echo "##"
echo "JTS3ServerMod Stop"
        service_stop
        sleep 5
echo "##"
echo "###################################"

echo "Erstelle Temp Verzeichniss.."
echo "###################################"
echo "##"
mkdir $JTS3PATH/temp/
echo "##"
echo "###################################"

echo "Downloade Upgrade....."
echo "###################################"
echo "##"
cd $JTS3PATH/temp/
wget $(sed 'N;s/-\n//;P;D;' $JTS3PATH/.jsupgradeurl | tr -d "[:space:]")
echo "##"
echo "###################################"

echo "Entpacke JTS3ServerMod.jar....."
echo "###################################"
echo "##"
unzip -d $JTS3PATH/temp $(cat $JTS3PATH/.jsupgradedateiname) JTS3ServerMod/JTS3ServerMod.jar
echo "##"
echo "###################################"

echo "Überschreibe JTS3ServerMod.jar....."
echo "###################################"
echo "##"
cp $JTS3PATH/temp/JTS3ServerMod/JTS3ServerMod.jar $JTS3PATH/JTS3ServerMod.jar
chown $USER:$USERG $JTS3PATH/JTS3ServerMod.jar
echo "##"
echo "###################################"

echo "Lösche Temp Dateien....."
echo "###################################"
echo "##"
cd $JTS3PATH/
rm -rf $JTS3PATH/temp/
echo "##"
echo "###################################"

echo "Aktualesiere Locale Verions Informationen....."
echo "###################################"
echo "##"
rm $JTS3PATH/.jsversion
echo $(cat $JTS3PATH/.jsupgradeversion) >> $JTS3PATH/.jsversion
chown $USER:$USERG $JTS3PATH/.jsversion
echo "##"
echo "###################################"

echo "JTS3ServerMod wurde aktualesiert."
echo "###################################"
echo "##"
echo "Aktuele JTS3ServerMod.jar Version:"
echo $(cat $JTS3PATH/.jsversion)
echo "##"
echo "###################################"

echo "Info.."
echo "###################################"
echo "##"
echo "Starten die den Server Neu"
echo "/etc/init.d/jts3servermod start"
echo "##"
echo "###################################"
fi
}

jsuptdatecheck () {
echo
echo "Check Update..."
if [ ! -f $JTS3PATH/.jsversion ]; then
  echo ""
  echo "Versions Check Fehler: die datei $JTS3PATH/.jsversion ist nicht vorhanden.. /n bitte Upgrade damit die datei angelegt wert. "
  echo "$(date +"%b %a %d  %H:%M:%S"): Versions Check Fehler: die datei $JTS3PATH/.jsversion ist nicht vorhanden.. /n bitte Upgrade damit die datei angelegt wert.  /" >> $LOGFILE
  exit 1
fi

if [ $QUELLE_UPGRADETYPE == 'stable' ]
    then
echo "stable"
wget $QUELLE_JTS3ServerMod -O $JTS3PATH/.jsversionquelle
export UPGRADEQUELLE=$(sed -n '1p' $JTS3PATH/.jsversionquelle)
export UPGRADEQUELLEVERSION=$(echo $UPGRADEQUELLESTABLE | awk 'BEGIN {FS = ";"} {print $2}')
  elif [ $QUELLE_UPGRADETYPE == 'beta' ]
    then
echo "beta"
wget $QUELLE_JTS3ServerMod -O $JTS3PATH/.jsversionquelle
export UPGRADEQUELLE=$(sed -n '2p' $JTS3PATH/.jsversionquelle)
export UPGRADEQUELLEVERSION=$(echo $UPGRADEQUELLEBETA | awk 'BEGIN {FS = ";"} {print $2}')
  else
echo "Fehlerhafte Upgrade version"
fi

if [ "$(cat $JTS3PATH/.jsupgradeversion)" == "$(cat $JTS3PATH/.jsversion)" ]
then
echo Sie haben die Neuste version.
else
echo
echo "Es ist eine Neues Update verfuegbar."
echo "Sie Koennen jetzt ein Upgade Starten."
echo "###################################"
echo "##"
echo "##"
echo "Locale JTS3ServerMod.jar Version: $(cat $JTS3PATH/.jsversion)"
echo "Quelle JTS3ServerMod.jar Version: $(cat $JTS3PATH/.jsupgradeversion)"
echo "##"
echo "##"
echo "###################################"
echo "/etc/init.d/jts3servermod jsupgrade"
echo
fi

}

scriptinfo () {
echo
echo "JTS3ServerMod Multi Init.d Script ....."
echo
echo "Programmierer: AnimaTow (Stephan Broeker)"
       echo "Website: http://www.os-up.com"
echo
echo "JTS3ServerMod Projekt"
echo "Programmierer: Stefan1200"
echo "Website: http://stefan1200.bplaced.net/"
       echo "Download Seite http://addons.teamspeak.com/"
echo
}

cronupgrade () {
  echo "$(date +"%b %a %d  %H:%M:%S"): Cron Job Upgrade Start." >> $LOGFILE
wget $QUELLE_JTS3ServerMod/.jsversion -O $JTS3PATH/.jsversionquelle
export JSVERSIONQUELLE=$(cat $JTS3PATH/.jsversionquelle)
    export JSVERSIONLOCAL=$(cat $JTS3PATH/.jsversion)
  echo "$(date +"%b %a %d  %H:%M:%S"): Quellen Version: $JSVERSIONQUELLE" >> $LOGFILE
  echo "$(date +"%b %a %d  %H:%M:%S"): Locale Version: $JSVERSIONLOCAL" >> $LOGFILE
    if [ "$JSVERSIONLOCAL" == "$JSVERSIONQUELLE" ]
    then
      echo "$(date +"%b %a %d  %H:%M:%S"): Cron Job Upgrade Neuste Version Vohanden." >> $LOGFILE
    else
        service_stop
        sleep 5
    wget $QUELLE_JTS3ServerMod/JTS3ServerMod.jar -O $JTS3PATH/JTS3ServerMod.jar
    wget $QUELLE_JTS3ServerMod/.jsversion -O $JTS3PATH/.jsversion
    service_start
      echo "$(date +"%b %a %d  %H:%M:%S"): Cron Job Upgrade auf Neuste Version: $JSVERSIONQUELLE Geupdatet." >> $LOGFILE
    fi
}

case "$1" in
    'start')
        service_start
    ;;
    'stop')
        service_stop
    ;;
    'restart')
        service_stop
        sleep 5
        service_start
    ;;
    'precheck')
        precheck
    ;;
    'jsupgrade')
        jsupgrade
    ;;
    'jsuptdatecheck')
        jsuptdatecheck
    ;;
    'scriptinfo')
        scriptinfo
    ;;
    'cronupgrade')
        cronupgrade
    ;;
*)
        echo "/etc/init.d/jts3servermod start          ## Startet den Server."
        echo "/etc/init.d/jts3servermod stop           ## Stopt den Server."
        echo "/etc/init.d/jts3servermod restart        ## Restartet den Server"
        echo "/etc/init.d/jts3servermod precheck       ## Checkt Kompatibilitaet des Servers."
        echo "/etc/init.d/jts3servermod jsupgrade      ## JTS3ServerMod Upgradet"
        echo "/etc/init.d/jts3servermod jsuptdatecheck ## Ceckt ob eine neue Version verfuegbar ist."
        echo "/etc/init.d/jts3servermod cronupgrade    ## Upgrade Cron Job fue AutoUpdate Chack und Upgrade"
        echo "/etc/init.d/jts3servermod scriptinfo     ## Informationen Über das Script"
esac

hoffe das hilft euch

Moki

  • JTS3ServerMod Internal
  • *****
  • Posts: 68
    • View Profile
Re: JTS3ServerMod Init.d Multi Script v1.16
« Reply #14 on: January 17, 2015, 03:52:03 AM »
Danke  :)
« Last Edit: February 15, 2018, 05:36:23 PM by Moki »