From 3ee20b17b1c75c61e939a55c3b0397855db74836 Mon Sep 17 00:00:00 2001 From: Jordan Ostreff Date: Fri, 21 Oct 2022 17:31:44 +0300 Subject: [PATCH] Create ghost-cli-update --- ghost-cli-update | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 ghost-cli-update diff --git a/ghost-cli-update b/ghost-cli-update new file mode 100644 index 0000000..bfb9a79 --- /dev/null +++ b/ghost-cli-update @@ -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