Skip to content

Commit

Permalink
refactor nc-scan-auto
Browse files Browse the repository at this point in the history
  • Loading branch information
nacho committed Aug 10, 2017
1 parent 3babcac commit 0595168
Showing 1 changed file with 23 additions and 19 deletions.
42 changes: 23 additions & 19 deletions etc/nextcloudpi-config.d/nc-scan-auto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ show_info()
20 90
}

install()
{
cat > /etc/systemd/system/nc-scan.service <<EOF
[Unit]
Description=Scan NC for externally modified files
[Service]
Type=simple
ExecStart=/usr/local/bin/ncp-scan
[Install]
WantedBy=default.target
EOF
}

configure()
{
[[ $ACTIVE_ != "yes" ]] && {
Expand All @@ -36,35 +51,24 @@ configure()
return 0
}

cat > /etc/systemd/system/nc-scan.timer <<EOF
[Unit]
Description=Timer to scan NC for externally modified files
[Timer]
OnBootSec=${SCANINTERVAL_}min
OnUnitActiveSec=${SCANINTERVAL_}min
Unit=nc-scan.service
[Install]
WantedBy=timers.target
EOF
cat > /etc/systemd/system/nc-scan.service <<EOF
cat > /etc/systemd/system/nc-scan.timer <<EOF
[Unit]
Description=Scan NC for externally modified files
Description=Timer to scan NC for externally modified files
[Service]
Type=simple
ExecStart=/usr/local/bin/ncp-scan
[Timer]
OnBootSec=${SCANINTERVAL_}min
OnUnitActiveSec=${SCANINTERVAL_}min
Unit=nc-scan.service
[Install]
WantedBy=default.target
WantedBy=timers.target
EOF

systemctl daemon-reload
systemctl enable nc-scan.timer
systemctl start nc-scan.timer
}

install() { :; }
cleanup() { :; }

# License
Expand Down

0 comments on commit 0595168

Please sign in to comment.