Merge pull request #4275 from RichieB2B/ncsc-nl/workers-stop

Add workers stop script
pull/4276/head
Andras Iklody 2019-03-05 23:36:37 +01:00 committed by GitHub
commit 59771dfbc7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 0 deletions

22
app/Console/worker/stop.sh Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/env bash
# TODO: Put some logic inside if many worker PIDs are detected
# Extract base directory where this script is and cd into it
cd "${0%/*}"
# Set to the current webroot owner
WWW_USER=$(ls -l ../cake |awk {'print $3'}|tail -1)
# In most cases the owner of the cake script is also the user as which it should be executed.
if [[ "$USER" != "$WWW_USER" ]]; then
echo "You run this script as $USER and the owner of the cake command is $WWW_USER. This might be an issue."
fi
# Check if run as root
if [[ "$EUID" -eq "0" ]]; then
echo "Please DO NOT run the worker script as root"
exit 1
fi
../cake CakeResque.CakeResque stop --all