From b1f27cfd8272d95d4e4fcec5f922d27bb83f901b Mon Sep 17 00:00:00 2001 From: alban Date: Sat, 7 Sep 2019 23:01:34 +0200 Subject: [PATCH] [enh] add auto upgrade script --- auto_upgrade_wekan.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 auto_upgrade_wekan.sh diff --git a/auto_upgrade_wekan.sh b/auto_upgrade_wekan.sh new file mode 100644 index 0000000..64fdf7b --- /dev/null +++ b/auto_upgrade_wekan.sh @@ -0,0 +1,26 @@ +#! /bin/bash + +# Provided as an example. The script is deployed by install.sh + +exec & >> /var/log/auto_upgrade_wekan.log +URL="https://releases.wekan.team/" +NEW=$(curl -s $URL | grep -e ">wekan.*zip"|sed -r "s/^.*>wekan-(.*?).zip<.*$/\1/"| sort | tail -n 1) +CUR=$(readlink /home/wekan/bundle| cut -d"/" -f 4) +[ "$NEW" == "$CUR" ] && exit 0 +[ -e /home/wekan/$NEW ] && exit 0 +echo "$(date) Install $NEW" +TMP=$( mktemp -d ) +cd "$TMP" +wget --quiet "$URL/wekan-$NEW.zip" +unzip "wekan-$NEW.zip" &>/dev/null +mv bundle "/home/wekan/$NEW" +cd "/home/wekan/$NEW/programs/server" +npm uninstall fibers +npm install fibers +chown -R wekan:wekan "/home/wekan/$NEW" +rm -rf "$TMP" +rm -f "/home/wekan/bundle" +ln -s "/home/wekan/$NEW" "/home/wekan/bundle" +supervisorctl restart wekan +echo "$(date) Restarted" +