Corerestarter Cronjob !

11/10/2013 17:50 [SA]ProtoTyp#1
Guten Abend.
Ich habe den Corerestarter installiert.
PHP Code:
#!/bin/sh

# Metin 2 Corerestarter
# v 1.0b
# by aiiR7


# Settings
GAMEDIR="/usr/home/"          # Gameordner
CH1DIR="$GAMEDIR/channel1/core1"
CH2DIR="$GAMEDIR/channel1/core2"
CH3DIR="$GAMEDIR/channel1/core3"
CH99DIR="$GAMEDIR/game99"
LOG="$GAMEDIR/corerestart.log"      # Name der Log-File (Liegt im Gameordner)
TIME=$(date)                         # Komplettes Date Format
FILE="$GAMEDIR/cron.start"            # Cronjob start datei

    
if [ -"$FILE]; then

      
## Channel 1

        
echo
        echo 
" ---------------------------------- " >> $LOG
        
echo "        BEGIN WITH CHANNEL 1        " >> $LOG
        
echo " ---------------------------------- " >> $LOG
        
echo


        
# DB-Cache
        
PIDDB=`ps aux | grep db | grep -v grep | awk '{print $2;}'`
        if [ 
"x$PIDDB!= "x" ]; then
        
echo "$(date)  :: Der Datenbankserver (DB-Cache) ist Online. PID: $PIDDB>> $LOG
        
else
        echo 
"$(date)  :: Der Datenbankserver (DB-Cache) ist Offline." >> $LOG
        
echo "$(date)  :: Der Datenbankserver (DB-Cache) wird neugestartet ..." >> $LOG
        cd $GAMEDIR
/Server/db && ./db &
        
sleep 5
        PIDDBR
=`ps aux | grep db | grep -v grep | awk '{print $2;}'`
        echo 
"$(date)  :: Der Datenbankserver (DB-Cache) wurde neugestartet. PID: $PIDDBR>> $LOG
        fi


        
# Auth
        
PIDAUTH=`ps aux | grep auth | grep -v grep | awk '{print $2;}'`
        if [ 
"x$PIDAUTH!= "x" ]; then
        
echo "$(date)  :: Der Loginserver (Auth) ist Online. PID: $PIDAUTH>> $LOG
        
else
        echo 
"$(date)  :: Der Loginserver (Auth) ist Offline." >> $LOG
        
echo "$(date)  :: Der Loginserver (Auth) wird neugestartet ..." >> $LOG
        cd $GAMEDIR
/Server/auth && ./auth &
        
sleep 5
        PIDAUTHR
=`ps aux | grep auth | grep -v grep | awk '{print $2;}'`
        echo 
"$(date)  :: Der Loginserver (Auth) wurde neugestartet. PID: $PIDAUTHR>> $LOG
        fi


        
# Game99 1
        
PIDGAME991=`ps aux | grep game99 | grep -v grep | awk '{print $2;}'`
        if [ 
"x$PIDGAME991!= "x" ]; then
        
echo "$(date)  :: Der game99 Core ist Online. PID: $PIDGAME991>> $LOG
        
else
        echo 
"$(date)  :: Der game99 Core ist Offline." >> $LOG
        
echo "$(date)  :: Der game99 Core wird neugestartet ..." >> $LOG
        cd $CH99DIR 
&& ./game99 &
        
sleep 5
        PIDGAME991R
=`ps aux | grep game99 | grep -v grep | awk '{print $2;}'`
        echo 
"$(date)  :: Der game99 Core wurde neugestartet. PID: $PIDGAME991R>> $LOG
        fi
        
        
        
# First
        
PIDFIRST=`ps aux | grep core1 | grep -v grep | awk '{print $2;}'`
        if [ 
"x$PIDFIRST!= "x" ]; then
        
echo "$(date)  :: Der First Core ist Online. PID: $PIDFIRST>> $LOG
        
else
        echo 
"$(date)  :: Der First Core ist Offline." >> $LOG
        
echo "$(date)  :: Der First Core wird neugestartet ..." >> $LOG
        cd $CH1DIR
/ && ./core1 &
        
sleep 5
        PIDFIRSTR
=`ps aux | grep core1 | grep -v grep | awk '{print $2;}'`
        echo 
"$(date)  :: Der First Core wurde neugestartet. PID: $PIDFIRSTR>> $LOG
        fi

        
## Channel 2

        
echo
        echo 
" ---------------------------------- " >> $LOG
        
echo "        BEGIN WITH CHANNEL 2        " >> $LOG
        
echo " ---------------------------------- " >> $LOG
        
echo


        
PIDFIRST=`ps aux | grep core2 | grep -v grep | awk '{print $2;}'`
        if [ 
"x$PIDFIRST!= "x" ]; then
        
echo "$(date)  :: Der First Core ist Online. PID: $PIDFIRST>> $LOG
        
else
        echo 
"$(date)  :: Der First Core ist Offline." >> $LOG
        
echo "$(date)  :: Der First Core wird neugestartet ..." >> $LOG
        cd $CH2DIR
/ && ./core2 &
        
sleep 5
        PIDFIRSTR
=`ps aux | grep core2 | grep -v grep | awk '{print $2;}'`
        echo 
"$(date)  :: Der First Core wurde neugestartet. PID: $PIDFIRSTR>> $LOG
        fi

        
## Channel 3

        
echo
        echo 
" ---------------------------------- " >> $LOG
        
echo "        BEGIN WITH CHANNEL 3        " >> $LOG
        
echo " ---------------------------------- " >> $LOG
        
echo


        
# First
        
PIDFIRST=`ps aux | grep core3 | grep -v grep | awk '{print $2;}'`
        if [ 
"x$PIDFIRST!= "x" ]; then
        
echo "$(date)  :: Der First Core ist Online. PID: $PIDFIRST>> $LOG
        
else
        echo 
"$(date)  :: Der First Core ist Offline." >> $LOG
        
echo "$(date)  :: Der First Core wird neugestartet ..." >> $LOG
        cd $CH4DIR
/ && ./core3 &
        
sleep 5
        PIDFIRSTR
=`ps aux | grep core3 | grep -v grep | awk '{print $2;}'`
        echo 
"$(date)  :: Der First Core wurde neugestartet. PID: $PIDFIRSTR>> $LOG
        fi

        
echo
        echo 
" --------------------------------- " >> $LOG
        
echo
    
fi 
Meine Frage ist wie Installiere ich den Cronjob!?
11/11/2013 15:41 theo1990#2
hi du gehst in die shell und gibst fogendes ein

Quote:
crontab -e
Dort erscheint ein Text der dir erklärt wie du einen crontab eingibst.
Du drückst "a" und nun befindest du dich im einfügmodus. Jetzt kannst du am schluss des Textes folgendes eingeben: (Wenn du den text unten kopierst hast musst du in der shell nur einmal auf rechte Maustaste drücken um diesen einzufügen)

Quote:
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
sprich wenn du es immer alle 5 min ausführen willst wäre es so:

Quote:
*/5 * * * * cd /PFAD/ZU/DEINEM/SHELL/SCRIPT && sh DEINSCRIPT.sh
weitere Infos kannste dir hier reinziehen -> [Only registered and activated users can see links. Click Here To Register...]