diff options
author | nachoparker <nacho@ownyourbits.com> | 2018-03-04 19:36:06 +0300 |
---|---|---|
committer | nachoparker <nacho@ownyourbits.com> | 2018-03-07 16:14:38 +0300 |
commit | 1c23fa7bc1c6506d0a3f86657f9b2c9803979f03 (patch) | |
tree | d32280f71c07aaa1bd792070c54a08db0f5785e1 /etc | |
parent | e912749dc66760cd1be2568caf45c85dae2fdcd1 (diff) |
nc-backup-auto: change to using cronv0.46.40
Diffstat (limited to 'etc')
-rw-r--r-- | etc/nextcloudpi-config.d/nc-backup-auto.sh | 39 |
1 files changed, 6 insertions, 33 deletions
diff --git a/etc/nextcloudpi-config.d/nc-backup-auto.sh b/etc/nextcloudpi-config.d/nc-backup-auto.sh index 5c1ebcdd..0fc6e541 100644 --- a/etc/nextcloudpi-config.d/nc-backup-auto.sh +++ b/etc/nextcloudpi-config.d/nc-backup-auto.sh @@ -22,26 +22,10 @@ BACKUPDAYS_=7 BACKUPLIMIT_=4 DESCRIPTION="Periodic backups" -install() -{ - cat > /etc/systemd/system/nc-backup.service <<EOF -[Unit] -Description=Backup Nextcloud instance - -[Service] -Type=simple -ExecStart=/usr/local/bin/ncp-backup-auto - -[Install] -WantedBy=default.target -EOF -} - configure() { [[ $ACTIVE_ != "yes" ]] && { - systemctl stop nc-backup.timer - systemctl disable nc-backup.timer + rm /etc/cron.d/ncp-backup-auto echo "automatic backups disabled" return 0 } @@ -49,30 +33,19 @@ configure() cat > /usr/local/bin/ncp-backup-auto <<EOF #!/bin/bash sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --on -ncp-backup "$DESTDIR_" "$INCLUDEDATA_" "$COMPRESS_" "$BACKUPLIMIT_" +/usr/local/bin/ncp-backup "$DESTDIR_" "$INCLUDEDATA_" "$COMPRESS_" "$BACKUPLIMIT_" sudo -u www-data php /var/www/nextcloud/occ maintenance:mode --off EOF chmod +x /usr/local/bin/ncp-backup-auto - cat > /etc/systemd/system/nc-backup.timer <<EOF -[Unit] -Description=Timer to backup NC periodically - -[Timer] -OnBootSec=${BACKUPDAYS_}days -OnUnitActiveSec=${BACKUPDAYS_}days -Unit=nc-backup.service + echo "0 3 */${BACKUPDAYS_} * * root /usr/local/bin/ncp-backup-auto" > /etc/cron.d/ncp-backup-auto + service cron restart -[Install] -WantedBy=timers.target -EOF - - systemctl daemon-reload - systemctl enable nc-backup.timer - systemctl start nc-backup.timer echo "automatic backups enabled" } +install() { :; } + # License # # This script is free software; you can redistribute it and/or modify it |