Skip to content

Commit

Permalink
Add Auto Restarter
Browse files Browse the repository at this point in the history
  • Loading branch information
Insa committed Aug 6, 2017
1 parent 7ed2d51 commit 8d2a1ad
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions StartQHandler.sh
@@ -0,0 +1,47 @@
#!/bin/bash

THIS_FULLPATH=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd -P)/`basename "${BASH_SOURCE[0]}"`
THIS_FOLDERPATH=$(cd `dirname "${BASH_SOURCE[0]}"` && pwd -P)

Q_BIN="php artisan queue:work --queue=convert,download --tries=1"
Q_SRC=downloadnconvert

QPATH=/var/www/pr0verter.de



startQ()
{
if [ "$(screen -ls | grep $Q_SCR)" ]
then
echo The Q is is already running!
else
cd $QPATH
screen -AmdS $Q_SCR $THIS_FULLPATH $Q_BIN
echo $Q_SCR Queue is alive!
fi
}

stopQ()
{
screen -S $Q_SCR -X kill &>/dev/null
echo $Q_SCR Queue shutdowned!
}

while x=1;
do
./$Q_BIN
sleep 1
done
;;
"start" )
startQ
;;
"stop" )
stopQ()
;;
* )
echo Invalid Argument
echo "usage: start | stop"
exit 1
;;

0 comments on commit 8d2a1ad

Please sign in to comment.