forked from NeoBlack/T3Bot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Auto restart botty after crashing
This script tries to catch the situation when the PHP scripts crashes and the daemon must be restarted afterwards manually by introducing another loop directly in bash. The loop will be terminated after the PIDFILE was deleted by the calling the stop action. Solves NeoBlack#13
- Loading branch information
1 parent
4f29a10
commit a16d7d7
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/sh | ||
|
||
###################################################### | ||
# | ||
# T3Bot | ||
# | ||
# @author Simon Gilli <[email protected]> | ||
# | ||
# @link http://www.t3bot.de | ||
# @link http://wiki.typo3.org/T3Bot | ||
# | ||
# @param NAME | ||
# @param PID file | ||
# @param LOG file | ||
# @param DAEMON file | ||
# @param DAEMON options | ||
# | ||
###################################################### | ||
|
||
|
||
# Read arguments and shift to get access to all options | ||
NAME=$1 | ||
PIDFILE=$2 | ||
LOGFILE=$3 | ||
DAEMON=$4 | ||
|
||
shift 4 | ||
|
||
# Test arguments | ||
test -n $NAME || exit 0 | ||
test -f $PIDFILE || exit 0 | ||
test -x $DAEMON || exit 0 | ||
test -n $@ || exit 0 | ||
|
||
# Loop while PID file exists | ||
while [ -f $PIDFILE ] | ||
do | ||
"$DAEMON" $@ | ||
echo "$NAME restored" >> $LOGFILE | ||
done | ||
|
||
echo "$NAME has terminated" >> $LOGFILE | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters