Since quite a while i was often asked if there is a possibility to store entries into crontab permanently on NAS devices with fun_plug. That is not that easy as the devices reset their crontab to the default one on every reboot. Therefore you need to add the entries every time the device reboots. I have now developed a script which automates that for your convenience. Werbung
The package with the name “uwcron” is available via my repository:
slacker -UaA uli:uwcron [[ -f /ffp/start/uwcron.sh.new ]] && mv /ffp/start/uwcron.sh.new /ffp/start/uwcron.sh
As soon as this is installed, you can start with the configuration. The configuration files should be created in
/ffp/etc/cron.d/. These could look like this:
*/5 * * * * /tmp/uwfancontrol.sh
When all configuration files are created, the service can be started. This works as with all other services:
chmod a+x /ffp/start/uwcron.sh /ffp/start/uwcron.sh start
Now you should see your entries in crontab:
If the device is rebootet, all entries from these files in
/ffp/etc/cron.d/ would be copied into crontab. if you made a change to a file, you could also just restart the service instead of the complete NAS:
63 thoughts on “uwcron: Cron for the fun_plug”
Thank you! I set uwcron on my D-Link DNS-325. Everything works fine.
Nice! Thank You!
Sadly the first instruction is not clear: are we supposed to run ‘slacker -UaA… ‘ and then enter the next line “[[ -f /ffp… ” ?
Are both one command or 2?
Using ‘slacker -UaA… ‘ seems to install fine.
these are two commands, you need to execute them both. If this is the first installation, you could leave it aside, but just to be sure, do them both.
After the install of uwcron on the DNS320, every command for crontab results in the following error message: “crontab: symbol ‘_res’: can’t resolve symbol”
I created in /ffp/etc/cron.d/ the file ‘rsnapshot’ with standard cron instructions.
Looks like the PATH is not set properly. Can you run your commands with full path?
That did it 😉 Ok, works perfectly with full path.
Did work without full path before the installation, though…
Works fine, thanks!
I installed fun_plug and uwfancontrol on DNS-320L but it seems that some commands (temperature and fanspeed) are missing.
I didn’t find those commands in any downloadable package, am I missing something or there is a compatibility issue between uwfancontrol and 320L (firmware 1.02b7)?
slacker -UaA command i get the following error, and dont know what to do to fix it.
Looks to me as if you have mixed up funplug 0.5 and 0.7. did you upgrade from 0.5?
I am running an old version of ffp (probably 0.5).
How could I get this installed via funpkg ? Where could I get uwcron tar.gz file?
i can use the command “mailto” into uwcron?? thanks!
The command is “mail” and can be configured on the commandline. Please use the full path to the binary to ensure a working crontab.
You made my day, I crashed my DNS 325 yesterday by trying to modify template config XML file…
Thank you for your script
I’ve tried editing crontab -e using nano, and i received the following error:
Received SIGHUP or SIGTERM
How can I resolve this to edit my crontab?
dns320 with ffp 0.7
it’s work fine for some hours…
and after crontab -l report me that will be reset to initial state…
i haven’t found which routine will be lauched any 6/8 hours…
tnks in adv…
Did you find a solution? See my problems below.
Is it possible to run python scripts from cron?
* * * * * python /mnt/HD_a2/frame/script.py
Enter the full path to python 🙂
I also find the crontab -l to be reset periodically. Did anybody find what process is doing this?
I have the same issue on my DNS320. It works after install and manual starting of uwcron.sh but after some time it gets reverted.
Also having the same issue. It seems to have only recently started. And it’s not related to uwcron because I’m not running it. i wrote my own crontab insertion script.
@Jan – this still happens in 2016 , even though
!#/ffp/bin/sh is added on the top of each cron instruction file
Thanks, it works 🙂 my nas drive is like a mini low powered server now:)
Hi, I was node ring if someone could point me in the Rightdirection.
Issue, the uwcron does not seem to run my custom scripts anymore. Simple script that echos and writes content to file as test. I was working when I installed funpkug, with uli’s uwcron to my d link 320L nas drive on volume 1. The uwcron config file is placed in /ffp/etc/cron.d/crontab.1112 with permission set to root and 777. The script is located in the roots’s home directory. I also restarted the /ffp/start/uwcron.
The configuration worked will I modified the /ffp/etc/cron.d/crontab.1112 file for another script. It did not work and revered back to the original entry which did not help.
Oh the system cron devices are working correctly. I get daily status emails which shows the system cron is functional.
I also find the crontab -l to be reset periodically.
The problem seems to be that my script that was called from crontab started with #!/bin/sh
Starting the script with #!/ffp/bin/sh
seems to solve the problem.
Why? Try typing /bin/sh in a terminal on the DNS320 and you are in the ash shell, waiting for input. Cron can’t supply this input. I am not sure why the crontab is reset after this, but the time matched perfectly with when my script is running.
Solved. Thie solution I described works perfectly!
I am having this problem as well. My script does start with #!/ffp/bin/sh and still, the cron table gets reset periodically.
My mistake, issue was I was using a call script and the system did not know what directory I was in which mean t the script I wanted to all could not be found. Once full path filled the script executed correctly.
I was wrong: still get reset of crontab to default. The crontab reset at 06:50:01, again. Always the same time.
I know this (within 10 minutes) because I added this row to the modified crontab in /ffp/etc/cron.d/cronjobs
Any luck in resolving this? I’m still having the same issue with crontab resetting to default.
Yes, see other post. Need my scripts called from uwcron to start with
I can not start the service.
The message is
What can i do to fix that? I have a lot space from my hard disk
Looks like something has filled up your internal flash – reboot and try again. If the problem persists, you need to find the culprit which fills that – that will be enerving 😉
*Hi I cannot exit/save the file crontab -e
how do I do it?
“As soon as this is installed, you can start with the configuration. The configuration files should be created in /ffp/etc/cron.d/. These could look like this:”
What are these configuration files? what format shall they be in?
Do you know what cron is? The format is displayed above, that is a flat text file.
To check the usage of vi, please check the searchengine of your choice: http://lmgtfy.com/?q=vi%20usage
I have gotten cron to work, end the instruction is visible when i write crontab -l
But I cant get it to launch a java-application.
When I run the shellscript it works fine.
But cron doesnt seem to run it.
The script looks like this
My guess is that cron cant fint the path to java, thats why I have added that path…
But still no luck, any tips?
As Jan and Sidneydream I have had the same issue (crontab was reseted periodically).
A way to solve this problem, without using uwcron has been to :
– create a file with the original tasks to be croned in /mnt/HD/HD_a2/ffp/home/root
crontab -l >> crontab.config
– then to add the new tasks I wanted to be periodiccaly launched
– then create a new file, let say ‘initcrontab.sh’ in /ffp/start and add in it the following line
-and finally make it executable for all
After rebooting it works.
@Sylvain – Trying your method. My crontab just keeps resetting back for no apparent reason.
@Sylvain – nope. the crontab still got reset ….
Oh man ….
@Sylvain , @Jan – and yes , looks like it keeps getting reset every 6-8 hours or so after reboot
So now i am adding a line ( every 30 mins ) in the cron to rerun “crontab filname” to repopulate the cron. Lets see what happens. Long shot but lets see.
The last thing to try would be to edit the config.xml file as mentioned here
Hmmmm …jumping straight to the config.xml method ..better chance of succeeding I reason.
After a few days, the only method that lasted was to have another cronned script running every 30m to run crontab with the custom scripts;
Create this script in /ffp/start – call it checkcrontab.sh and make it executable.
I’m not sure if anyone else is having this issue but I haven’t seen it be published anywhere.
I’ve followed all of the steps (which have been well written above). When I try crontab -l my commands appear and I do not see any error messages.
However, the commands don’t seem to execute at all. They are not lost, as when I check crontab -l again they are still in there.
Basically, all I have in the script is
* * * * * /mnt/HD/HD_a2/ffp/sbin/*program*
And another line to kill the pid after several more hours.
I’ve tried a simpler script just with an echo every minute but nothing appears in the terminal.
If it makes any difference, I’m using FDP 0.7 and a dlink 320 (not l).
Has it been removed?
root@NAS:~# slacker -UaA uli:uwcron
Updating package lists…
fetch: rsync -q ‘rsync://ffp.inreto.de/ffp/0.7/arm/packages/CHECKSUMS.md5’ ‘/ffp/funpkg/cache/s’
No packages found (status Iiu, pattern (^uli:.*uwcron))
No, you did not add my repository.
Do you have an idiots guide on how to do that 🙂
Hi, I am trying to run a command line using UWCRON, after I run the command crontab -l the line are apearing like this
the files are stored in
/ffp/etc/cron.d/a.sh. a.sh contains the lines
and b.sh contains the lines
If I run sh
/ffp/start/a.shstart the script is running fine but uwcron is not running anything.
Does anyone have an ideea how to resolve this problem?
If I run sh /ffp/start/b.sh start the script is running fine but ucron is not running anything. – i my first post the last 2 lines are typed wrong.
I had the same reset issue of the other folks. I’m using Sylvian solution without the ‘uwcron’ and it’s working. I have the DNS-320L with 1.04 firmware and fun_plug 0.7.
Actually this didn’t work as well, I had my crontab reset after some hours. I’m testing the solution adding my jobs directly on the config.xml file according to this post: http://forums.dlink.com/index.php?topic=46532.0
@Alex – did that method work for you ?
on my iomega ez-nas, crontabs are kept in the etc folder, not in the bin folder, so i’m getting the error:
/ffp/start/uwcron.sh: line 19: /bin/crontab: No such file or directory
/ffp/start/uwcron.sh: line 51: /bin/crontab: No such file or directory
would it work if i changed the uwcron.sh file to point to the etc directory instead?
ah, found it- It works if you change the /bin/crontab parts to /mnt/apps/usr/bin/crontab
I tried this on a DNS-345 with the last firmware released for it.
I’m using this to run ddclient – a PERL script to update “any” DDNS service.
At first, I seemed to have Jan’s problem. But since this is a Perl script, adding a shebang for SH would not work well. So instead a created a small SH script that is run by CRON. And that script has Jan’s recommended shebang. This seems to work.
But, after a varying amount of time, my CRON list (as per crontab -l) gets reset back to the D-link value!
I set my script up to run every 5 minutes, and it creates a log of the last run. So I can see that file date stamp updating as expected at least once. Then it stops, and the cron list is back to default.
Its like I need another cron task to reset my cron tasks…
@Richard Cooke – Did you solve your problem ?
I came to the conclusion that D-Link’s firmware is regularly CLEARING the cron list back to their default. So any changes will get removed – quite quickly. Adding something to run on reboot will not help; the drive is not rebooting.
I solved my problem by writing my own DDNS updater in Python, and running it on the computer that is also the FAX/security camera machine, so its always running. This has worked perfectly!
I’m having the same problem on DNS-320L, did you solve?
What time does the cron run ? At midnight ? Any config file for us to edit ?
Oops … i mean something more along like a cron.daily but looks like that is not available in fun_plug right ?
The simplest way is to create a file on startup, make it executable and put in it a command to copy your good crontab file over the default crontab file.
For example: you have your custom crontab file named root in /i-data/somePath/root. The default crontab file name also root is located on /var/spool/cron/crontabs.
You simply need to overwrite at startup the default crontab file with yours.
To do this you need to create an executable file in /ffp/start/
Let name it croninit.sh. The content of that file is:
cp /i-Data/somePath/root /var/spool/cron/crontabs/
to make it executable type on the command line:
# chmod +x /ffp/start/croninit.sh