diff options
Diffstat (limited to 'herculeswrapper/include.sh')
-rw-r--r-- | herculeswrapper/include.sh | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/herculeswrapper/include.sh b/herculeswrapper/include.sh new file mode 100644 index 0000000..97325f8 --- /dev/null +++ b/herculeswrapper/include.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +function create_pipe { + trap "rm -f $PIPE" EXIT + if [[ ! -p $PIPE ]]; then + echo "Making pipe $PIPE" + rm -f $PIPE + mkfifo $PIPE + fi +} + +# $1 - text +function send_all_pipes { + echo $1 >$LOGIN_PIPE + echo $1 >$CHAR_PIPE +} + +# $1 - text +function send_char_pipe { + echo $1 >$CHAR_PIPE +} + +# $1 - server binary name +# $2 - sleep time +function server_logic { + create_pipe + $1 + + while true + do + if read line <$PIPE; then + echo pipe: $line + if [[ "$line" == 'exit' ]]; then + exit + fi + if [[ "$line" == 'restart' ]]; then + sleep $2 + $1 + fi + fi + done +} + +function pull_all { + ls + # Update Server Data + cd ../ + ./pull.sh force + # Update Client Data + cd testserver + ./pseudo_update.sh + cd .. + # Return to server data + cd server-data +} + |