October 11, 20223 yr I have found some older guides for setting up cron jobs in Unraid but none of them seem to work. One guide said put a file in the /etc/cron.d directory. One guide said put a file in /boot/config/plugins directory. Even adding it to the non-persistent crontab -e doesn't do anything. When I issue the update_cron command I see nothing happening in the syslogs. Any direction is appreciated. My file consist of the following: 53 20 * * * * ./mnt/cache/appdata/python/photosync_vid_docker.sh All this does is kick off a python script via docker that moves some files. That script has been tested and works. Edited October 11, 20223 yr by jneely911 type
October 11, 20223 yr Community Expert Solution User Scripts plugin is the easiest way to work with scripting + cron in unraid, it also adds addition events for start/stop of array.
October 11, 20223 yr Author Thanks tjb_altf4, I did see that as an option. I have some experience with Linux and was hoping just to use cron. I installed user scripts yesterday. I will check it out this afternoon. Thanks
May 31, 20233 yr On 10/11/2022 at 6:59 AM, jneely911 said: Thanks tjb_altf4, I did see that as an option. I have some experience with Linux and was hoping just to use cron. I installed user scripts yesterday. I will check it out this afternoon. Thanks this is kind of old but you can edit cron on /etc/cron.d/root use nano or vi and you can enter what you want but i second user scripts you set it and it enters the cron schedule directly into the file i just mentioned
May 31, 20233 yr Community Expert 53 minutes ago, Can0n said: this is kind of old but you can edit cron on /etc/cron.d/root use nano or vi and you can enter what you want Actually this will not work as expected as any such edit will not survive a reboot since that location is only in RAM and also Unraid may wipe out the edit at any time. Using User Scripts plugin takes care of this persistence issue.
May 31, 20233 yr 28 minutes ago, itimpi said: Actually this will not work as expected as any such edit will not survive a reboot since that location is only in RAM and also Unraid may wipe out the edit at any time. Using User Scripts plugin takes care of this persistence issue. It does work Any changes made to the operating system get written back to the USB immediately. Case in point I came across this post due to an rsync error I was seeing in my logs. I checked user scripts it wasn't there so i found the Rsync command I used to run on a server that doesn't exist anymore in the logs. I found it in /etc/cron.d in a file called root that server destination has been decommissioned for over a year My newest user scripts from less than a month ago were there too and my server has was restarted just 8 days ago
June 8, 20233 yr No, it doesn't get saved for me. I have a similar issue and I have no idea where I added that cron job, and no matter how I modify the /etc/cron.d/root file, it always revert back after I restart the server or start the array. I took some instructions on this forum very long ago as there was no such thing as user scripts back then and have no idea how to reset/remove it now
June 9, 20233 yr On 6/7/2023 at 8:21 PM, CyberMew said: No, it doesn't get saved for me. I have a similar issue and I have no idea where I added that cron job, and no matter how I modify the /etc/cron.d/root file, it always revert back after I restart the server or start the array. I took some instructions on this forum very long ago as there was no such thing as user scripts back then and have no idea how to reset/remove it now it saves for me so not sure what voodoo magic my server is doing but i got some old Cron jobs there before I was using before User scripts came out and i even commented it out due to it not longer being valid and ocassionaly showing the invalid path in my logs when it ran. but after a massive issue last night with BTRFS errors flooding my logs and causing my VM and dockers to all crash I had to reboot forcibly due to stopping array failing and the comment # is still there so not sure what is happening to keep mine there User Scripts even puts its schedules in there
June 9, 20233 yr You might have put something in your go file then. /etc is not persistent, so if someone manually changes something there it won’t survive a reboot. For most use cases though, user scripts is the way to go.
July 6, 20233 yr i checked my go...issue with mine is the old job keeps coming back....its not in user scripts and not in my go file. if i stop the array and start it its back
July 6, 20233 yr It's coming from your /boot volume (the flash drive) - probably easiest to determine a keyword in your cronjob - something somewhat unique if possible. Then you can do something like this to figure out where that root cron is coming from: $ grep -r "mykeyword" /boot/ That should give you a list of the possible matches and hopefully it's easy to determine where the root cron is coming from.
July 6, 20233 yr 51 minutes ago, Delarius said: It's coming from your /boot volume (the flash drive) - probably easiest to determine a keyword in your cronjob - something somewhat unique if possible. Then you can do something like this to figure out where that root cron is coming from: $ grep -r "mykeyword" /boot/ That should give you a list of the possible matches and hopefully it's easy to determine where the root cron is coming from. sadly putting the old server name in the keywords only pulls old syslog files i might have to stop and start the array again to get it to show up in /etc/cron.d/root againi have a sneaking suspecision its an old user.script plugin file lingering and staying active but could be something else
July 6, 20233 yr It's definitely somewhere on that /boot drive, just a matter of figuring out how to search for it. Not sure using the old servername is the right approach. The cronjob will no doubt look something like this: 5 4 * * 0 /root/backup.sh So in this instance I'd try using "backup.sh" as my keyword.
July 6, 20233 yr 15 minutes ago, Delarius said: It's definitely somewhere on that /boot drive, just a matter of figuring out how to search for it. Not sure using the old servername is the right approach. The cronjob will no doubt look something like this: 5 4 * * 0 /root/backup.sh So in this instance I'd try using "backup.sh" as my keyword. yeah i will make a better note when it comes back after a stop and start of the array no luck finding it so far
July 6, 20233 yr 4 hours ago, Delarius said: It's definitely somewhere on that /boot drive, just a matter of figuring out how to search for it. Not sure using the old servername is the right approach. The cronjob will no doubt look something like this: 5 4 * * 0 /root/backup.sh So in this instance I'd try using "backup.sh" as my keyword. So just noticed it showed up again with no stop n start of the array here is a screnshot of the the /etc/cron.d/root file and maybe i using grep wrong but no results using the cron schedule with rsync command and its options (Attached too)
July 6, 20233 yr Community Expert I would suggest searching the boot drive as indicated using 'Freya_Backup' as the search string as that looks unlikely to give many false positives.
July 6, 20233 yr 12 hours ago, Delarius said: It's definitely somewhere on that /boot drive, just a matter of figuring out how to search for it. Not sure using the old servername is the right approach. The cronjob will no doubt look something like this: 5 4 * * 0 /root/backup.sh So in this instance I'd try using "backup.sh" as my keyword. found it!! thank you for your help root@Thor:~# nano /etc/cron.d/root grep -r "Backup Share to Freya" /boot/ /boot/config/plugins/dynamix/thor2freya.cron:#*** rsync Thor's Backup Share to Freya
July 6, 20233 yr 24 minutes ago, Can0n said: found it!! thank you for your help root@Thor:~# nano /etc/cron.d/root grep -r "Backup Share to Freya" /boot/ /boot/config/plugins/dynamix/thor2freya.cron:#*** rsync Thor's Backup Share to Freya Thanks so much for sharing your findings! Mine was placed there as well. I think this was the post I came across last time Finally, I can resolve it now.
July 6, 20233 yr 7 hours ago, itimpi said: I would suggest searching the boot drive as indicated using 'Freya_Backup' as the search string as that looks unlikely to give many false positives. found it under /boot/config/plugins/dynamix/thor2freya.cron renamed it thor2freya.cron.old I have other crons I created there I am going to remove I created that almost 5 years ago when i had 3 unraid servers. the Freya ultimately died and i recycled it the 3rd one has become a windows Server 2022 Printer Server as the case drive bays was killing drives at an alarming rate. now its just a single 256GB SSD laying inside the case
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.