Want to schedule delete files and folders on attached USB drive.
- sharper9
- Know my way around
- Posts: 196
- Joined: Fri Jun 06, 2008 6:10 pm
Re: Want to schedule delete files and folders on attached USB drive.
Thanks - I'll get it done over the weekend
All the best
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
- sharper9
- Know my way around
- Posts: 196
- Joined: Fri Jun 06, 2008 6:10 pm
Re: Want to schedule delete files and folders on attached USB drive.
Here you go.
I changed to the start time to 5am. Hope I did it right?
many thanks again......
I changed to the start time to 5am. Hope I did it right?
Code: Select all
[~] # crontab -l
# m h dom m dow cmd
0 3 * * 0 /etc/init.d/idmap.sh dump
0 4 * * * /sbin/hwclock -s
0 3 * * * /sbin/vs_refresh
0 3 * * * /sbin/clean_reset_pwd
0-59/15 * * * * /etc/init.d/nss2_dusg.sh
30 7 * * * /sbin/clean_upload_file
0 2 * * * /sbin/qfstrim
0-59/10 * * * * /etc/init.d/storage_usage.sh
30 3 * * * /sbin/notice_log_tool -v -R
10 15 * * * /usr/bin/power_clean -c 2>/dev/null
10 0 * * * /etc/init.d/antivirus.sh scan 1
0 0 * * * /etc/init.d/antivirus.sh archive_log
08 0 */1 * * /etc/init.d/antivirus.sh update_db
* * * * * /mnt/ext/opt/netmgr/util/lock_timer.sh
35 7 * * * /sbin/qbox_util -c > /dev/null 2>/dev/null
4 3 * * 3 /etc/init.d/backup_conf.sh
19 * * * * /sbin/qddns_check 2>/dev/null
0 5 * * * /share/50014EE20BA4E444_DATA/.system/archive-old-stuff.sh
All the best
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
- OneCD
- Guru
- Posts: 12146
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
- sharper9
- Know my way around
- Posts: 196
- Joined: Fri Jun 06, 2008 6:10 pm
Re: Want to schedule delete files and folders on attached USB drive.
Great thanks!OneCD wrote:Looks good.
All the best
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
- sharper9
- Know my way around
- Posts: 196
- Joined: Fri Jun 06, 2008 6:10 pm
Re: Want to schedule delete files and folders on attached USB drive.
Hi
Been away for few day (hernia operation)
Noticed 25-27th of March is missing on mysmalldisk disk.
Been away for few day (hernia operation)
Noticed 25-27th of March is missing on mysmalldisk disk.
All the best
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
- OneCD
- Guru
- Posts: 12146
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
Re: Want to schedule delete files and folders on attached USB drive.
Hey, hope you're well.
I've been testing this at my end and haven't been able to replicate the issue you've seen.
So, I've made some changes that will display some information about the move and delete operations as they occur. We'll then capture this to a log file, which can be examined later. This should tell us if something is going wrong.
Here's a new version of the script. I've already included your paths in it, and the 'safety' is already turned off. Please download this into your Public share, then move and rename it as follows:
Mark it as executable:
Then, we need to add something to the end of your existing crontab entry.
Follow the previous process for editing your crontab file and change the entry from:to
Save this as per the crontab editing process.
Then, let this run as usual for a few days. If it looks like it's not behaving itself, you can check the log file with:
I've been testing this at my end and haven't been able to replicate the issue you've seen.
So, I've made some changes that will display some information about the move and delete operations as they occur. We'll then capture this to a log file, which can be examined later. This should tell us if something is going wrong.
Here's a new version of the script. I've already included your paths in it, and the 'safety' is already turned off. Please download this into your Public share, then move and rename it as follows:
Code: Select all
mv /share/Public/archive-old-stuff.gz /share/50014EE20BA4E444_DATA/.system/archive-old-stuff.sh
Code: Select all
chmod +x /share/50014EE20BA4E444_DATA/.system/archive-old-stuff.sh
Follow the previous process for editing your crontab file and change the entry from:
Code: Select all
0 11 * * * /share/50014EE20BA4E444_DATA/.system/archive-old-stuff.sh
Code: Select all
0 11 * * * /share/50014EE20BA4E444_DATA/.system/archive-old-stuff.sh >> /share/50014EE20BA4E444_DATA/.system/nvr-archiver.log
Then, let this run as usual for a few days. If it looks like it's not behaving itself, you can check the log file with:
Code: Select all
cat /share/50014EE20BA4E444_DATA/.system/nvr-archiver.log
You do not have the required permissions to view the files attached to this post.
- sharper9
- Know my way around
- Posts: 196
- Joined: Fri Jun 06, 2008 6:10 pm
Re: Want to schedule delete files and folders on attached USB drive.
Get to it in the morning
Thx
Thx
All the best
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
- sharper9
- Know my way around
- Posts: 196
- Joined: Fri Jun 06, 2008 6:10 pm
Re: Want to schedule delete files and folders on attached USB drive.
Done thx
be in touch
be in touch
All the best
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
- sharper9
- Know my way around
- Posts: 196
- Joined: Fri Jun 06, 2008 6:10 pm
Re: Want to schedule delete files and folders on attached USB drive.
I dont think this is good
Code: Select all
[~] # cat /share/50014EE20BA4E444_DATA/.system/nvr-archiver.log
cat: /share/50014EE20BA4E444_DATA/.system/nvr-archiver.log: No such file or directory
All the best
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
- OneCD
- Guru
- Posts: 12146
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
Re: Want to schedule delete files and folders on attached USB drive.
Can you please run this and post back the result?
Code: Select all
crontab -l | grep old-stuff
- sharper9
- Know my way around
- Posts: 196
- Joined: Fri Jun 06, 2008 6:10 pm
Re: Want to schedule delete files and folders on attached USB drive.
Code: Select all
[~] # crontab -l | grep old-stuff
0 5 * * * /share/50014EE20BA4E444_DATA/.system/archive-old-stuff.sh
All the best
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
- OneCD
- Guru
- Posts: 12146
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
Re: Want to schedule delete files and folders on attached USB drive.
Ah, you forgot to add that extra command to the end of the crontab line.
It's shown in that post of mine further up this page - where you downloaded the latest script file.
It's shown in that post of mine further up this page - where you downloaded the latest script file.
- sharper9
- Know my way around
- Posts: 196
- Joined: Fri Jun 06, 2008 6:10 pm
Re: Want to schedule delete files and folders on attached USB drive.
I think I messed up on how to edit the crontab?OneCD wrote:Ah, you forgot to add that extra command to the end of the crontab line.
It's shown in that post of mine further up this page - where you downloaded the latest script file.
Cant remember, I looked but can you tell me so I get it right.
All the best
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
- OneCD
- Guru
- Posts: 12146
- Joined: Sun Aug 21, 2016 10:48 am
- Location: "... there, behind that sofa!"
Re: Want to schedule delete files and folders on attached USB drive.
Here's what do do:
- Edit your crontab file:
Code: Select all
nano /etc/config/crontab
- edit your entry for archive-old-stuff.sh.
So your crontab should then look like this. The order of the lines does not matter.# m h dom m dow cmd
0 3 * * 0 /etc/init.d/idmap.sh dump
0 4 * * * /sbin/hwclock -s
0 3 * * * /sbin/vs_refresh
0 3 * * * /sbin/clean_reset_pwd
0-59/15 * * * * /etc/init.d/nss2_dusg.sh
30 7 * * * /sbin/clean_upload_file
0 2 * * * /sbin/qfstrim
0-59/10 * * * * /etc/init.d/storage_usage.sh
30 3 * * * /sbin/notice_log_tool -v -R
31 * * * * /sbin/qddns_check 2>/dev/null
10 15 * * * /usr/bin/power_clean -c 2>/dev/null
10 0 * * * /etc/init.d/antivirus.sh scan 1
0 0 * * * /etc/init.d/antivirus.sh archive_log
08 0 */1 * * /etc/init.d/antivirus.sh update_db
* * * * * /mnt/ext/opt/netmgr/util/lock_timer.sh
35 7 * * * /sbin/qbox_util -c > /dev/null 2>/dev/null
4 3 * * 3 /etc/init.d/backup_conf.sh
0 11 * * * /share/50014EE20BA4E444_DATA/.system/archive-old-stuff.sh >> /share/50014EE20BA4E444_DATA/.system/nvr-archiver.log
- Ensure the last line of the file is empty,
- Save and exit the nano editor,
- Load your crontab file:
Code: Select all
crontab /etc/config/crontab
- Restart the cron daemon:
Code: Select all
/etc/init.d/crond.sh restart
- Confirm that your new crontab file has been loaded by the cron daemon:
Code: Select all
crontab -l
- sharper9
- Know my way around
- Posts: 196
- Joined: Fri Jun 06, 2008 6:10 pm
Re: Want to schedule delete files and folders on attached USB drive.
OneCD wrote:Here's what do do:
- Edit your crontab file:
Code: Select all
nano /etc/config/crontab
- edit your entry for archive-old-stuff.sh.
So your crontab should then look like this. The order of the lines does not matter.# m h dom m dow cmd
0 3 * * 0 /etc/init.d/idmap.sh dump
0 4 * * * /sbin/hwclock -s
0 3 * * * /sbin/vs_refresh
0 3 * * * /sbin/clean_reset_pwd
0-59/15 * * * * /etc/init.d/nss2_dusg.sh
30 7 * * * /sbin/clean_upload_file
0 2 * * * /sbin/qfstrim
0-59/10 * * * * /etc/init.d/storage_usage.sh
30 3 * * * /sbin/notice_log_tool -v -R
31 * * * * /sbin/qddns_check 2>/dev/null
10 15 * * * /usr/bin/power_clean -c 2>/dev/null
10 0 * * * /etc/init.d/antivirus.sh scan 1
0 0 * * * /etc/init.d/antivirus.sh archive_log
08 0 */1 * * /etc/init.d/antivirus.sh update_db
* * * * * /mnt/ext/opt/netmgr/util/lock_timer.sh
35 7 * * * /sbin/qbox_util -c > /dev/null 2>/dev/null
4 3 * * 3 /etc/init.d/backup_conf.sh
0 11 * * * /share/50014EE20BA4E444_DATA/.system/archive-old-stuff.sh >> /share/50014EE20BA4E444_DATA/.system/nvr-archiver.log
- Ensure the last line of the file is empty,
- Save and exit the nano editor,
- Load your crontab file:
Code: Select all
crontab /etc/config/crontab
- Restart the cron daemon:
Code: Select all
/etc/init.d/crond.sh restart
- Confirm that your new crontab file has been loaded by the cron daemon:
Code: Select all
crontab -l
Code: Select all
[~] # crontab -l
# m h dom m dow cmd
0 3 * * 0 /etc/init.d/idmap.sh dump
0 4 * * * /sbin/hwclock -s
0 3 * * * /sbin/vs_refresh
0 3 * * * /sbin/clean_reset_pwd
0-59/15 * * * * /etc/init.d/nss2_dusg.sh
30 7 * * * /sbin/clean_upload_file
0 2 * * * /sbin/qfstrim
0-59/10 * * * * /etc/init.d/storage_usage.sh
30 3 * * * /sbin/notice_log_tool -v -R
10 15 * * * /usr/bin/power_clean -c 2>/dev/null
10 0 * * * /etc/init.d/antivirus.sh scan 1
0 0 * * * /etc/init.d/antivirus.sh archive_log
08 0 */1 * * /etc/init.d/antivirus.sh update_db
* * * * * /mnt/ext/opt/netmgr/util/lock_timer.sh
35 7 * * * /sbin/qbox_util -c > /dev/null 2>/dev/null
19 * * * * /sbin/qddns_check 2>/dev/null
0 5 * * * /share/50014EE20BA4E444_DATA/.system/archive-old-stuff.sh >> /share/50014EE20BA4E444_DATA/.system/nvr-archiver.log
4 3 * * 3 /etc/init.d/backup_conf.sh
All the best
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads
TS251A 8GB 2 x 3TB JBOD for LMS and loads of other stuff. 2 Hikvision DS-2CD2342WD-I
Firmware 4.4.3.1354 - Windows 11 + 2 x iPads