Skip to content

Commit

Permalink
fix cron path
Browse files Browse the repository at this point in the history
  • Loading branch information
nachoparker committed Mar 23, 2019
1 parent e99662e commit 2460264
Show file tree
Hide file tree
Showing 9 changed files with 23 additions and 15 deletions.
6 changes: 3 additions & 3 deletions bin/ncp/BACKUPS/nc-backup-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ configure()

cat > /usr/local/bin/ncp-backup-auto <<EOF
#!/bin/bash
ncc maintenance:mode --on
/usr/local/bin/ncc maintenance:mode --on
/usr/local/bin/ncp-backup "$DESTDIR" "$INCLUDEDATA" "$COMPRESS" "$BACKUPLIMIT" || failed=true
ncc maintenance:mode --off
/usr/local/bin/ncc maintenance:mode --off
[[ "\$failed" == "true" ]] && \
ncc notification:generate "$NOTIFYUSER" "Auto-backup failed" -l "Your automatic backup failed"
/usr/local/bin/ncc notification:generate "$NOTIFYUSER" "Auto-backup failed" -l "Your automatic backup failed"
EOF
chmod +x /usr/local/bin/ncp-backup-auto

Expand Down
2 changes: 1 addition & 1 deletion bin/ncp/BACKUPS/nc-rsync-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ configure()
}

local DATADIR
DATADIR=$( sudo -u www-data php /var/www/nextcloud/occ config:system:get datadirectory ) || {
DATADIR=$( ncc config:system:get datadirectory ) || {
echo -e "Error reading data directory. Is NextCloud running and configured?";
return 1;
}
Expand Down
2 changes: 1 addition & 1 deletion bin/ncp/CONFIG/nc-autoupdate-nc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ echo -e "[ncp-update-nc]" >> /var/log/ncp.log
if [[ \${PIPESTATUS[0]} -eq 0 ]]; then
VER="\$( sudo -u www-data php /var/www/nextcloud/occ status | grep "version:" | awk '{ print \$3 }' )"
VER="\$( /usr/local/bin/ncc status | grep "version:" | awk '{ print \$3 }' )"
sudo -u www-data php /var/www/nextcloud/occ notification:generate \
"$NOTIFYUSER" "NextCloudPi" -l "Nextcloud was updated to \$VER"
Expand Down
2 changes: 1 addition & 1 deletion bin/ncp/CONFIG/nc-autoupdate-ncp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ configure()
#!/bin/bash
if /usr/local/bin/ncp-test-updates; then
/usr/local/bin/ncp-update || exit 1
sudo -u www-data php /var/www/nextcloud/occ notification:generate \
/usr/local/bin/ncc notification:generate \
"$NOTIFYUSER" "NextCloudPi" \
-l "NextCloudPi was updated to \$( cat /usr/local/etc/ncp-version )"
fi
Expand Down
4 changes: 2 additions & 2 deletions bin/ncp/CONFIG/nc-notify-updates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ echo "Found update from \$( cat \$VERFILE ) to \$( cat \$LATEST ). Sending notif
IFACE=\$( ip r | grep "default via" | awk '{ print \$5 }' | head -1 )
IP=\$( ip a show dev "\$IFACE" | grep global | grep -oP '\d{1,3}(\.\d{1,3}){3}' | head -1 )
ncc notification:generate \
/usr/local/bin/ncc notification:generate \
$USER "NextCloudPi update" \
-l "Update from \$( cat \$VERFILE ) to \$( cat \$LATEST ) is available. Update from https://\$IP:4443"
Expand Down Expand Up @@ -74,7 +74,7 @@ sed -i 's|INFO Packages that will be upgraded:|INFO Packages that will be upgrad
echo -e "Packages automatically upgraded: \$PKGS\\n"
# notify
ncc notification:generate \
/usr/local/bin/ncc notification:generate \
$USER "NextCloudPi Unattended Upgrades" \
-l "Packages automatically upgraded \$PKGS"
EOF
Expand Down
2 changes: 1 addition & 1 deletion bin/ncp/CONFIG/nc-previews-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ configure()
cat > /usr/local/bin/nc-previews <<EOF
#!/bin/bash
echo -e "\n[ nc-previews-auto ]" >> /var/log/ncp.log
ionice -c3 nice -n20 ncc preview:pre-generate -n -vvv 2>&1 >>/var/log/ncp.log &
ionice -c3 nice -n20 /usr/local/bin/ncc preview:pre-generate -n -vvv 2>&1 >>/var/log/ncp.log &
PID=\$!
[[ "$RUNTIME" != 0 ]] && {
for i in \$(seq 1 1 $RUNTIME); do
Expand Down
8 changes: 4 additions & 4 deletions bin/ncp/CONFIG/nc-scan-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ configure()
echo -e "\n[ nc-scan-auto ]"
[[ "$PATH1" != "" ]] && ncc files:scan -n -v -p "$PATH1"
[[ "$PATH2" != "" ]] && ncc files:scan -n -v -p "$PATH2"
[[ "$PATH3" != "" ]] && ncc files:scan -n -v -p "$PATH3"
[[ "$PATH1" != "" ]] && /usr/local/bin/ncc files:scan -n -v -p "$PATH1"
[[ "$PATH2" != "" ]] && /usr/local/bin/ncc files:scan -n -v -p "$PATH2"
[[ "$PATH3" != "" ]] && /usr/local/bin/ncc files:scan -n -v -p "$PATH3"
[[ "${PATH1}${PATH2}${PATH3}" == "" ]] && ncc files:scan -n -v --all
[[ "${PATH1}${PATH2}${PATH3}" == "" ]] && /usr/local/bin/ncc files:scan -n -v --all
) 2>&1 >>/var/log/ncp.log
EOF
Expand Down
4 changes: 2 additions & 2 deletions bin/ncp/CONFIG/nc-update-nc-apps-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ configure()
OUT="\$(
echo "[ nc-update-nc-apps-auto ]"
echo "checking for updates..."
ncc app:update --all -n
/usr/local/bin/ncc app:update --all -n
)"
echo "\$OUT" >> /var/log/ncp.log
APPS=\$( echo "\$OUT" | grep 'updated\$' | awk '{ print \$1 }')
[[ "\$APPS" != "" ]] && ncc notification:generate "$USER" "Apps updated" -l "\$APPS"
[[ "\$APPS" != "" ]] && /usr/local/bin/ncc notification:generate "$USER" "Apps updated" -l "\$APPS"
EOF
chmod 755 "$cronfile"
echo "automatic app updates enabled"
Expand Down
8 changes: 8 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,14 @@ EOF
# update sury keys
wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg

# fix cron path
is_active_app nc-backup-auto && run_app nc-backup-auto
is_active_app nc-scan-auto && run_app nc-scan-auto
is_active_app nc-autoupdate-ncp && run_app nc-autoupdate-ncp
is_active_app nc-notify-updates && run_app nc-notify-updates
is_active_app nc-previews-auto && run_app nc-previews-auto
is_active_app nc-update-nc-apps-auto && run_app nc-update-nc-apps-auto

# remove redundant opcache configuration. Leave until update bug is fixed -> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=815968
# Bug #416 reappeared after we moved to php7.2 and debian buster packages. (keep last)
[[ "$( ls -l /etc/php/7.2/fpm/conf.d/*-opcache.ini | wc -l )" -gt 1 ]] && rm "$( ls /etc/php/7.2/fpm/conf.d/*-opcache.ini | tail -1 )"
Expand Down

0 comments on commit 2460264

Please sign in to comment.