Skip to content

Commit

Permalink
Add root check
Browse files Browse the repository at this point in the history
  • Loading branch information
idanoo committed Aug 18, 2023
1 parent 9474ddd commit 29f4e7b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ HORIZON_SERVICE=horizon.service

set +x

# We want to su into web user, so lets be root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi

# Run the stuff
su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && git pull"
su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && composer install --no-ansi --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader"
su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && composer dump-autoload --optimize"
Expand All @@ -16,4 +23,4 @@ su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && php artisan route:cache"
su - $WEB_USER -s /bin/bash -c "cd $WEB_ROOT && php artisan migrate --force"

# Make sure we restart Horizon workers too
sudo systemctl restart $HORIZON_SERVICE
systemctl restart $HORIZON_SERVICE

0 comments on commit 29f4e7b

Please sign in to comment.