Skip to content

Commit

Permalink
Bugfix: Wallos Patch (Cron Log & Media Backup) (community-scripts#331)
Browse files Browse the repository at this point in the history
* Update wallos.sh

* Update wallos.sh

* Update wallos-install.sh

* Remove Empty Line
  • Loading branch information
MickLesk authored Nov 18, 2024
1 parent a3ff42b commit b794a48
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
9 changes: 5 additions & 4 deletions ct/wallos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,24 +55,25 @@ function default_settings() {

function update_script() {
header_info
check_container_storage
check_container_resources
if [[ ! -d /opt/wallos ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
if (( $(df /boot | awk 'NR==2{gsub("%","",$5); print $5}') > 80 )); then
read -r -p "Warning: Storage is dangerously low, continue anyway? <y/N> " prompt
[[ ${prompt,,} =~ ^(y|yes)$ ]] || exit
fi
RELEASE=$(curl -s https://api.github.com/repos/ellite/Wallos/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Updating ${APP} to ${RELEASE}"
cd /opt
wget -q "https://github.com/ellite/Wallos/archive/refs/tags/v${RELEASE}.zip"
mv /opt/wallos/db/wallos.db /opt/wallos.db
mv /opt/wallos/images/uploads /opt/images/uploads
unzip -q v${RELEASE}.zip
rm -rf /opt/wallos
mv Wallos-${RELEASE} /opt/wallos
rm -rf /opt/wallos/db/wallos.empty.db
mv /opt/wallos.db /opt/wallos/db/wallos.db
mv /opt/images/uploads /opt/wallos/images/uploads
chown -R www-data:www-data /opt/wallos
chmod -R 755 /opt/wallos
mkdir -p /var/log/cron
curl http://localhost/endpoints/db/migrate.php &>/dev/null
echo "${RELEASE}" >/opt/${APP}_version.txt
msg_ok "Updated ${APP}"
Expand Down
3 changes: 2 additions & 1 deletion install/wallos-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ $STD curl http://localhost/endpoints/db/migrate.php
msg_ok "Installed Wallos"

msg_info "Setting up Crontabs"
mkdir -p /var/log/cron
cat <<EOF > /opt/wallos.cron
0 1 * * * php /opt/wallos/endpoints/cronjobs/updatenextpayment.php >> /var/log/cron/updatenextpayment.log 2>&1
0 2 * * * php /opt/wallos/endpoints/cronjobs/updateexchange.php >> /var/log/cron/updateexchange.log 2>&1
Expand All @@ -78,4 +79,4 @@ msg_info "Cleaning up"
rm -rf /opt/v${RELEASE}.zip
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"
msg_ok "Cleaned"

0 comments on commit b794a48

Please sign in to comment.