Question: setup scheduled task
Posted: Tue Jun 30, 2020 7:24 pm
I would like to setup an scheduled task to deactivate and reactivete the surveillance center app every 2 days.
How can I do this?
How can I do this?
Don't know if it's include in the application itself ... if not use cron (shell started based on time schedule)shezhar wrote:I would like to setup an scheduled task to deactivate and reactivate the surveillance center app every 2 days.
How can I do this?
Code: Select all
# Every 1AM restart Surveillance Center if enabled
0 1 * * * apkg --info-installed nvr|grep -q 'Enabled: Yes' && { apkg --disable nvr && sleep 20 && apkg --enable nvr; }
Code: Select all
crontab -l|tee asustor-old.cron asustor-new.cron
Code: Select all
vi asustor-new.cron
Code: Select all
crontab < asustor-new.cron
Code: Select all
# Every 1AM restart Surveillance Center if enabled
0 1 * * * apkg --info-installed nvr|grep -q 'Enabled: Yes' && /volume1/.@plugins/AppCentral/nvr/CONTROL/start-stop.sh restart
Code: Select all
touch /usr/var/restartnvr.sh
Code: Select all
vi /usr/var/restartnvr.sh
save and exit (ESC+ ":wq")#!/bin/sh
apkg --disable nvr
sleep 20
apkg --enable nvr
Code: Select all
sudo crontab -e
This will start the script file at 2am every 2 days.0 2 */2 * * /usr/bin/sh /usr/var/restartnvr.sh
PS: Don't use /usr/var as the rootfs mount will revert at boot, so use /root or other location instead.Hope this direction wont be updated, and the file deleted