14 changed files with 111 additions and 31 deletions
@ -1,9 +1,20 @@ |
|||
#!/bin/bash |
|||
|
|||
. /usr/local/bin/maint-mode |
|||
mode_get |
|||
mode_on |
|||
|
|||
if [[ ! -f $1 ]]; then |
|||
>&2 echo "Error: could not find file \"$1\"" |
|||
exit 2 |
|||
fi |
|||
|
|||
mode=$(nc-occ maintenance:mode | cut -d' ' -f 5) |
|||
if [[ $mode != "enabled" ]]; then |
|||
nc-occ maintenance:mode --on |
|||
fi |
|||
|
|||
db-make |
|||
psql -U $DBUSER -d $DBNAME -f $1 |
|||
|
|||
mode_off |
|||
|
@ -0,0 +1,22 @@ |
|||
#!/bin/bash |
|||
|
|||
mode_get() { |
|||
mode=$(nc-occ maintenance:mode | cut -d' ' -f 5) |
|||
if [[ $mode == "enabled" || $mode == "disabled" ]]; then |
|||
echo $mode |
|||
return 0 |
|||
else |
|||
echo "Error: failed to get maintenance mode" 1>&2 |
|||
return 1 |
|||
fi |
|||
} |
|||
|
|||
mode_on() { |
|||
nc-occ maintenance:mode --on |
|||
} |
|||
|
|||
mode_off() { |
|||
if [[ $mode == "disabled" ]]; then |
|||
nc-occ maintenance:mode --off |
|||
fi |
|||
} |
@ -0,0 +1,9 @@ |
|||
#!/bin/bash |
|||
|
|||
if [[ -n $1 ]]; then |
|||
nc-occ files:scan --path="/$1/files/" |
|||
else |
|||
for user in $(nc-occ user:list --output=json | jq -r 'keys[]'); do |
|||
nc-occ files:scan --path="/$user/files/" |
|||
done |
|||
fi |
@ -1,2 +0,0 @@ |
|||
#!/bin/sh |
|||
sed -i '/session required pam_loginuid.so/c\#session required pam_loginuid.so' /etc/pam.d/cron |
@ -0,0 +1,8 @@ |
|||
[Unit] |
|||
Description=Scan files every 15 minutes |
|||
|
|||
[Timer] |
|||
OnCalendar=0/15:00 |
|||
|
|||
[Install] |
|||
WantedBy=timers.target |
@ -0,0 +1,9 @@ |
|||
[Unit] |
|||
Description=Nextcloud cron.php job |
|||
|
|||
[Service] |
|||
User=www-data |
|||
ExecStart=/usr/bin/php -f /var/www/nextcloud/cron.php |
|||
StandardOutput=journal |
|||
StandardError=journal |
|||
KillMode=process |
@ -0,0 +1,9 @@ |
|||
[Unit] |
|||
Description=Run Nextcloud cron.php every 5 minutes |
|||
|
|||
[Timer] |
|||
OnBootSec=5min |
|||
OnUnitActiveSec=5min |
|||
|
|||
[Install] |
|||
WantedBy=timers.target |
@ -0,0 +1,8 @@ |
|||
[Unit] |
|||
Description=Scan Nextcloud files for changes |
|||
|
|||
[Service] |
|||
ExecStart=/usr/local/bin/maint-scan |
|||
StandardOutput=journal |
|||
StandardError=journal |
|||
Type=oneshot |
@ -0,0 +1,8 @@ |
|||
[Unit] |
|||
Description=Scan files every 15 minutes |
|||
|
|||
[Timer] |
|||
OnCalendar=0/15:00 |
|||
|
|||
[Install] |
|||
WantedBy=timers.target |
Loading…
Reference in new issue