1
0
mirror of https://github.com/tteck/Proxmox.git synced 2024-12-14 11:40:10 +02:00
Proxmox/misc/uptimekuma-update.sh

75 lines
1.9 KiB
Bash
Raw Normal View History

2022-04-22 21:54:50 +02:00
#!/usr/bin/env bash -ex
2022-06-14 21:57:33 +02:00
LATEST=$(curl -sL https://api.github.com/repos/louislam/uptime-kuma/releases/latest | grep '"tag_name":' | cut -d'"' -f4)
2022-10-30 03:04:45 +02:00
YW=$(echo "\033[33m")
BL=$(echo "\033[36m")
RD=$(echo "\033[01;31m")
BGN=$(echo "\033[4;92m")
GN=$(echo "\033[1;92m")
DGN=$(echo "\033[32m")
CL=$(echo "\033[m")
2022-04-22 21:54:50 +02:00
BFR="\\r\\033[K"
HOLD="-"
CM="${GN}${CL}"
APP="Uptime Kuma"
while true; do
2022-06-14 21:57:33 +02:00
read -p "This will Update ${APP} to ${LATEST}. Proceed(y/n)?" yn
2022-04-22 21:54:50 +02:00
case $yn in
2022-10-30 03:04:45 +02:00
[Yy]*) break ;;
[Nn]*) exit ;;
*) echo "Please answer yes or no." ;;
2022-04-22 21:54:50 +02:00
esac
done
clear
function header_info {
2022-10-30 03:04:45 +02:00
echo -e "${DGN}
2022-04-22 21:54:50 +02:00
_ _ _ _ _ __
| | | | | | (_) | |/ /
| | | |_v3_ | |_ _ _ __ ___ ___ | ' /_ _ _ __ ___ __ _
| | | | _ \| __| | _ _ \ / _ \ | <| | | | _ _ \ / _ |
| |__| | |_) | |_| | | | | | | __/ | . \ |_| | | | | | | (_| |
\____/| .__/ \__|_|_| |_| |_|\___| |_|\_\__,_|_| |_| |_|\__,_|
| |
|_| UPDATE
${CL}"
}
header_info
function msg_info() {
local msg="$1"
echo -ne " ${HOLD} ${YW}${msg}..."
}
function msg_ok() {
local msg="$1"
echo -e "${BFR} ${CM} ${GN}${msg}${CL}"
}
2022-10-30 03:04:45 +02:00
if [ ! -d "/opt/uptime-kuma" ]; then
echo -e "No Uptime Kuma Directory Found."
exit
fi
2022-04-22 21:54:50 +02:00
2022-06-14 21:57:33 +02:00
msg_info "Stopping ${APP}"
2022-04-22 22:04:59 +02:00
sudo systemctl stop uptime-kuma &>/dev/null
2022-06-14 21:57:33 +02:00
msg_ok "Stopped ${APP}"
2022-04-22 22:04:59 +02:00
cd /opt/uptime-kuma
2022-04-22 21:54:50 +02:00
2022-06-14 21:57:33 +02:00
msg_info "Pulling ${APP} ${LATEST}"
2022-10-11 13:22:09 +02:00
git fetch --all &>/dev/null
git checkout $LATEST --force &>/dev/null
2022-04-22 22:08:16 +02:00
git pull &>/dev/null
2022-06-14 21:57:33 +02:00
msg_ok "Pulled ${APP} ${LATEST}"
2022-04-22 21:54:50 +02:00
2022-10-11 13:22:09 +02:00
msg_info "Updating ${APP} to ${LATEST}"
npm install --production &>/dev/null
npm run download-dist &>/dev/null
2022-06-14 21:57:33 +02:00
msg_ok "Updated ${APP}"
2022-04-22 21:54:50 +02:00
2022-06-14 21:57:33 +02:00
msg_info "Starting ${APP}"
2022-04-22 22:04:59 +02:00
sudo systemctl start uptime-kuma &>/dev/null
2022-06-14 21:57:33 +02:00
msg_ok "Started ${APP}"
2022-04-22 21:54:50 +02:00
msg_ok "Done!"