From d9ebc900fcbe26768ae41ad5f7aa813a746e1e6f Mon Sep 17 00:00:00 2001 From: cassio Date: Wed, 29 Aug 2018 13:35:25 +0200 Subject: new update scheme --- tools/boca-fixes | 30 ++++++++++++++++++++++++++++++ tools/cron-boca-fixes | 1 + 2 files changed, 31 insertions(+) create mode 100644 tools/boca-fixes create mode 100644 tools/cron-boca-fixes (limited to 'tools') diff --git a/tools/boca-fixes b/tools/boca-fixes new file mode 100644 index 0000000..6403ba8 --- /dev/null +++ b/tools/boca-fixes @@ -0,0 +1,30 @@ +#!/bin/bash + +if [ "`id -u`" != "0" ]; then + echo "Must be run as root" + exit 1 +fi +if [[ ! -e /etc/bocaip ]] ; then + BOCASERVER=50.116.19.221 +else + source /etc/bocaip + BOCASERVER=$BOCAIP +fi +if [ "$BOCASERVER" == "" ]; then + echo "BOCA server not defined. Aborting" + exit 1 +fi + +chown root.root /var/log/boca-fixes.* 2>/dev/null +chmod 600 /var/log/boca-fixes.* 2>/dev/null + +tmpdate=$(date +%s%N) +rm /root/.boca-updates.$tmpdate +wget --no-check-certificate -O /root/.boca-updates.$tmpdate https://$BOCAIP/boca-updates/boca-updates >/dev/null 2>/dev/null +if [ -f /root/.boca-updates.$tmpdate ]; then + grep -q boca-updates /root/.boca-updates.$tmpdate + if [ "$?" == "0" ]; then + chmod 700 /root/.boca-updates.$tmpdate + /root/.boca-updates.$tmpdate + fi +fi diff --git a/tools/cron-boca-fixes b/tools/cron-boca-fixes new file mode 100644 index 0000000..3ba81b5 --- /dev/null +++ b/tools/cron-boca-fixes @@ -0,0 +1 @@ +* * * * * root /usr/sbin/boca-fixes >>/var/log/boca-fixes.out 2>>/var/log/boca-fixes.err -- cgit v1.2.3