Thanks for all your help! Unfortunately a) I had auto update to off., and b) Even removing that entry from the crontab does not work (cron only calls it once per day → 0 0 * * *) - Something else must be calling that script :robotsad:
Given that - I would recommend anyone reading to avoid 1.04.04 if they need a crontab.
EDIT: Editing my reply - since my last one didn’t provide anything relevant and was unnecessarily long. Anyway, looking at your process listing I don’t see any except the httpd that are different than mine…and obviously I don’t expect that one to be an the issue. So, sorry, this cron issue might not be solved very easily.
So I’ve done my last bit of digging I think, and here are the findings.
It looks like there are quite a few binaries that kill and restart crond!
A quick grep of files within directories in /usr/local/modules came up with the following:
cgi/wizard_mgr.cgi:kill -9 pidof crond
cgi/wizard_mgr.cgi:crond&
cgi/system_mgr.cgi:kill -9 pidof crond
cgi/system_mgr.cgi:crond&
usrlib/libctc.so:killall crond ; crond
Further, based on some of the greps, it appears that one of these binary files builds the crontab from the config XML file + some static entries(see an exert from open one of the binaries in vi that restart the cron service - this is just my guess based on the cat, etc).
As I said very early on, right in my second post…the ONLY way for you to solve this issue would be to bake-in your cron changes into the firmware’s source code. All these digging will give you clues and maybe even some answers but not the solution. I do think that would be your best solution in this case, since cron is wiping itself off. Having your own job right in the cron’s original list of jobs will keep your job running all the time even when the cron tab file gets reset every half hour or so. It is rather unfortunate that WD has implemented such a stupid solution for whatever they are trying to achieve by wiping cron itself. Gives very little room for our own solutions.
You probably will want to try this (at your own risk)… It’s just what I did and it works. Even after reboots.
Go to /usr/local/config and edit the config.xml file by adding an entry in the section of the XML.
Add an entry to the crond/list. This basically list number of cron jobs to be added. See mine below, I added surveillance to the list. You must also alter the number of jobs in , but this looks like you have to enter the count - 1 instead. I don’t know why. But it would work.
7
user.log
stime
wd_crontab
app_get_info
auto_fw
surveillance
random_check
fw_available
…
Next, you define details of your cron entry as if you were using crontab -e, but now in an XML-formatted form:
3
<1>*/5</1>
<2>*</2>
<3>*</3>
<4>*</4>
<5>*</5>
cd /shares/Public/Surveillance;python capture.py
The entry is to be inserted at the same level as the entry, i.e. as a direct child of . Notice that the name of the task’s xml element is the name you put in between and in the crond/list/name element.
The trick is that if you get to the web admin interface and do anything that would trigger a config to be saved, the machine will replace your config.xml by the file it cached in the memory (looks like that it is from /etc/NAS_CFG/config.xml). So your changes will be wiped off. Unfortunately the reboot operation from the web interface is also causing the config to be dumped, which resulted in config.xml being replaced. Hence you should do the reboot right from the command line:
sync
reboot
This way the config retained.
After a reboot, if you look around at config.xml, you might discover that your added entry may be rearranged. But that should be ok as long as everything is still there.
Excellent workaround siamese. I should have thought of this alternative solution.
I do recommend creating a backup of the original /usr/local/config/config.xml before editing that. What happens on reboot is that this file gets copied over to /etc/NAS_CFG/config.xml and settings from that config.xml are then read from and used. So yes, this would allow you to have a persistent cron job.
jacksparrow - I finally decided to update to the latest firmware (1.04.05) and I noticed that before even I put in my custom changes in the firmware, the stock firmware does not appear to be updating crontab every 30 mins. Not sure what was happening with the previous firmware as I never installed it, but thought you might want to know about the current firmware.
After verifying that crontab isn’t losing anything on it’s own even after 30 minutes have elapsed, I then removed three jobs at the startup in my custom firmware code:
Nope…with stock config my cron wasn’t being reset. In fact, my suspicion last night was that even in previous firmware it wasn’t being reset, but I never applied the previous firmware so couldn’t confirm it. I think you have something a bit different. Something you might have modified maybe. I don’t know what it could be. The one other thing that may or may not be relevant is that I don’t have send notifications/alerts turned off. But I’m leaning towards that having no impact on this. I really waited to be sure well past the 45-minute mark and the timestamp for the very file you mentioned above remained unchanged. I unfortunately have no idea what’s different on your system that’s making this behave differently. That job of yours that you wanted to run…make sure that is completely off of cron. Also, I highly recommend you shutdown your EX2…not a reboot but a shutdown and then turn it back on after a couple minutes.
jaclsparrow - I meant to write this sooner but somehow forgot.
I spoke too soon with my last reply - I stand corrected. You were correct. It does appear that something in EX2’s frmware constantly keep putting those jobs back - the only thing I have noticed is that it takes several hours and is not within the much shorter 30-minute window that you described. That is why I did not see it in the 45-minute trial window I tested it with. But I do see that sometime after 3-5 hours those pesky jobs come back.
So I am about to take a stronger approach this time and basically have a job myself that wil run every hour and all it will do is update cron to MY list of jobs - removing those annoying jobs. I will probably end up finding that whatever is updating cron will still update cron and therefore remove my cron-update job and thus my cron will no longer keep only my specified jobs. And if that happens, I have another idea up my sleeve.
Reset button doesn’t erase data but wipes all settings, including users and brings the device’s config to factory settings. If the changes you tried broke it, then obviously you did something wrong…but nothing that was mentioned should have affected the functioning of EX2 except cron behavior. If you do these things, you gotta have a good idea what you are doing…or else don’t attempt them.
Having a good idea of what I’m doing is all relative, I had the same issue as many, my cronjobs where not persisting so I tried to edit config.xml as mentionned in this thread. I added the lines corresponding to the cronjob I wanted to set up.
I then rebooted the machine but was not able to access it again, locally or remotly.
I have a My Could Mirror not EX2.
It looks like the booting failed, is there any way to get out of there? The data need to be recovered.
Mirror and EX2 should behave identically in this regard…so it doesn’t matter.
The ONLY way for me or nobody else to be able to say what went wrong is to see exactly what you replaced in the config file and with what. Saying that you followed the directions outlined by the other poster tells me very little. A single missing character could make all the difference. And now that you have reset your Mirror, you don’t have the broken config file anymore…so unless you backed up the original one and your modded one and can post the relevant sections here, it’ll be impossible to trace what went wrong. You can always attempt it again…this time backing up the files outside of the device as well, for later troubleshooting if need be. All I can say is, I’ve been modding the config file since EX2 came out almost 6 months ago but it has never rendered my device unreachable.