Create ghost-cli-update

This commit is contained in:
Jordan Ostreff 2022-10-21 17:31:44 +03:00 committed by GitHub
parent db9f93e203
commit 3ee20b17b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

23
ghost-cli-update Normal file
View file

@ -0,0 +1,23 @@
#!/usr/local/bin/bash
ghost="/usr/home/ghost"
pushd $ghost
output=`sudo -u ghost -D $ghost /usr/local/bin/ghost check-update`
echo "$output"
if [[ "$output" == *"available"* ]]; then
echo "Checking the permissions in GHOST-CMS home ..."
sudo -u ghost -D $ghost /usr/bin/find ./ ! -path "./versions/*" -type f -exec chmod 664 {} \;
sudo -u ghost -D $ghost GHOST_NODE_VERSION_CHECK=false /usr/local/bin/ghost update
echo "Restarting GHOST-CMS ..."
/usr/sbin/service ghost restart
elif [[ "$output" == *"update"* ]]; then
echo "Checking the permissions in GHOST-CMS home ..."
sudo -u ghost -D $ghost /usr/bin/find ./ ! -path "./versions/*" -type f -exec chmod 664 {} \;
sudo -u ghost -D $ghost GHOST_NODE_VERSION_CHECK=false /usr/local/bin/ghost update
echo "Restarting GHOST-CMS ..."
/usr/sbin/service pm2 restart
else
echo "No new version of GHOST-CMS detected."
fi
popd