Skip to content
Permalink
Browse files

Add Auto Restarter

  • Loading branch information...
Insax committed Aug 6, 2017
1 parent 7ed2d51 commit 8d2a1ade4480828e8fdbb9f8c40c8e649543e787
Showing with 47 additions and 0 deletions.
  1. +47 −0 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.
You can’t perform that action at this time.