NETGEAR is aware of a growing number of phone and online scams. To learn how to stay safe click here.
Forum Discussion
vifferNL
Sep 21, 2012Aspirant
Cronjobs on ReadyNas NV+
Hi all,
I have a securitycamera that uploads automatically images (over FTP) when it detects movement. This can result in large numbers of files (I've had more then 500.000 files :oops: ) so I want a new folder created every day and copy the files inthere. So I wrote a little script to do this for me
When I run this script manually this works fine. But I don't want to run this script manually every day, so I thought of creating a cronjob. I copied the script into the cron.daily folder and created a crontab file to activate this script
I activated this cronjob by typing
When I look at the running crons it appears to be active
I've also checked the crontab to see if the crontab.daily folder is called
But all that happens, a new folder isn't created and my images aren't moved. In the cron.log it looks like the script is called but I can't figur out what I'm doing wrong.
I have also tried to put the script in the daily.d folder but this has no effect as well. Anyone have an idea?
Thanks!
I have a securitycamera that uploads automatically images (over FTP) when it detects movement. This can result in large numbers of files (I've had more then 500.000 files :oops: ) so I want a new folder created every day and copy the files inthere. So I wrote a little script to do this for me
#! /bin/sh
mkdir /FTPupload/$(date -d yesterday +%Y.%m.%d)
find /FTPupload/ -type f -maxdepth 1 -daystart -mtime +0 -exec mv {} /FTPupload/$(date -d yesterday +%Y.%m.%d)/ \;
When I run this script manually this works fine. But I don't want to run this script manually every day, so I thought of creating a cronjob. I copied the script into the cron.daily folder and created a crontab file to activate this script
0 10 * * * /etc/cron.daily/FTPUpload_opruimen.sh
I activated this cronjob by typing
crontab cron_jobs.txt
When I look at the running crons it appears to be active
# crontab -l
0 10 * * * /etc/cron.daily/FTPUpload_opruimen.sh
I've also checked the crontab to see if the crontab.daily folder is called
# cat crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file.
# This file also has a username field, that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
25 6 * * * root test -e /usr/sbin/anacron || nice run-parts --report /etc/cron.daily
47 6 * * 7 root test -e /usr/sbin/anacron || nice run-parts --report /etc/cron.weekly
52 6 1 * * root test -e /usr/sbin/anacron || nice run-parts --report /etc/cron.monthly
#
But all that happens, a new folder isn't created and my images aren't moved. In the cron.log it looks like the script is called but I can't figur out what I'm doing wrong.
Sep 21 10:00:01 QW-NAS-001 /USR/SBIN/CRON[17355]: (root) CMD (/etc/cron.daily/FTPUpload_opruimen.sh^M)
Sep 21 10:08:01 QW-NAS-001 /USR/SBIN/CRON[17539]: (root) CMD ( /usr/bin/empty_exim &>/dev/null)
I have also tried to put the script in the daily.d folder but this has no effect as well. Anyone have an idea?
Thanks!
3 Replies
Replies have been turned off for this discussion
- jenzbeAspirantHoi vifferNL,
I have a similar problem.
I had a task scheduled to copy my nzb-files automatically from one folder to another (which sabnzbd monitors).
Now AFTER the latest Radiator update this does not run anymore.
I dont think you have a problem with your script, i think they changed something we are missing.
PLZ keep me posted if u find a solluction (en sorry dat ik jou niet kon helpen) - vifferNLAspirantNo worries jenzbe ;)
I still don't have the cron running as I would like (at the time I want) but I got a bit further after a lot of googling.
The ReadyNas runs all scripts in the cron.daily folder at 6:25 (this is the time in the crontab file). There is one major "but". The script shoudn't have the extension ".sh". I'm not sure about other extensions, I've removed the extension completely.
Maybe someday I will try to get a cron running at the time I want but for now it works for me. - jenzbeAspirantHey viffer, i just noticed: i think i have the cron thingy running again.
I only adjusted the rights of the cronjob (to 755 i think).
Today it has downloaded my nzb's so i think ik works again.
You can read my old post here: viewtopic.php?f=23&t=58179
Related Content
NETGEAR Academy
Boost your skills with the Netgear Academy - Get trained, certified and stay ahead with the latest Netgear technology!
Join Us!