March 2, 201511 yr on beta14 i get all my cron job logs mailed to me. how can i deactivate it? my other server 5.0.5 doesn't do this with the same command. its a cronjob to rsync files to an external NAS. pls give me a hint this is the command: crontab -l > /tmp/file; echo '# Run rsync at 5 am every day' >> /tmp/file; echo '00 5 * * * rsync -avH --delete --stats --progress /mnt/user/loni/ rsync://leroy/loni' >>/tmp/file; crontab /tmp/file; rm /tmp/file thank you in advance
March 2, 201511 yr on beta14 i get all my cron job logs mailed to me. how can i deactivate it? my other server 5.0.5 doesn't do this with the same command. its a cronjob to rsync files to an external NAS. pls give me a hint this is the command: crontab -l > /tmp/file; echo '# Run rsync at 5 am every day' >> /tmp/file; echo '00 5 * * * rsync -avH --delete --stats --progress /mnt/user/loni/ rsync://leroy/loni' >>/tmp/file; crontab /tmp/file; rm /tmp/file thank you in advance Create the following for your crontab # Run rsync at 5 am every day 00 5 * * * rsync -avH --delete --stats --progress /mnt/user/loni/ rsync://leroy/loni & >/dev/null The redirection to /dev/null will suppress the emailing.
March 3, 201511 yr Author its 14, no letter, as written. thnx bonienl, but is it still the full command with crontab at the beginning? like this: crontab -l > /tmp/file; echo '# Run rsync at 5 am every day' >> /tmp/file; echo '00 5 * * * rsync -avH --delete --stats --progress /mnt/user/loni/ rsync://leroy/loni' & >/dev/null or your short version, just: # Run rsync at 5 am every day 00 5 * * * rsync -avH --delete --stats --progress /mnt/user/loni/ rsync://leroy/loni & >/dev/null
March 3, 201511 yr its 14, no letter, as written. You should update to 14b, as it contains a number of bug fixes
March 4, 201511 yr its 14, no letter, as written. thnx bonienl, but is it still the full command with crontab at the beginning? like this: crontab -l > /tmp/file; echo '# Run rsync at 5 am every day' >> /tmp/file; echo '00 5 * * * rsync -avH --delete --stats --progress /mnt/user/loni/ rsync://leroy/loni' & >/dev/null or your short version, just: # Run rsync at 5 am every day 00 5 * * * rsync -avH --delete --stats --progress /mnt/user/loni/ rsync://leroy/loni & >/dev/null Your long version includes the creation of the entries in crontab, while the short version just displays what will be added to crontab.
March 4, 201511 yr Author ok, now i updated to b6-14b sorry, i'm still new to the unix world. this is in my go file right now and its working on 5.0.5 and beta 6. but on 6 i get all the logs mailed to me. # Backup r5-server Folder to r5-server-bckp NAS crontab -l > /tmp/file; echo '# Run rsync at 5 am every day' >> /tmp/file; echo '00 5 * * * rsync -avH --delete --stats --progress /mnt/user/Account rsync://r5-server-bckp/rsynced' >>/tmp/file; crontab /tmp/file; rm /tmp/file crontab -l > /tmp/file; echo '# Run rsync at 5 am every day' >> /tmp/file; echo '00 5 * * * rsync -avH --delete --stats --progress /mnt/user/Audio rsync://r5-server-bckp/rsynced' >>/tmp/file; crontab /tmp/file; rm /tmp/file crontab -l > /tmp/file; echo '# Run rsync at 5 am every day' >> /tmp/file; echo '00 5 * * * rsync -avH --delete --stats --progress /mnt/user/Release rsync://r5-server-bckp/rsynced' >>/tmp/file; crontab /tmp/file; rm /tmp/file crontab -l > /tmp/file; echo '# Run rsync at 5 am every day' >> /tmp/file; echo '00 5 * * * rsync -avH --delete --stats --progress /mnt/user/Stock rsync://r5-server-bckp/rsynced' >>/tmp/file; crontab /tmp/file; rm /tmp/file how can i write a slimmer command to do all the jobs and not getting any mails instantly?
March 8, 201511 yr Pls help on the last meters;) Another (simpler) approach which does not require to write to crontab is to place the commands to be executed under /etc/cron.daily. By default the daily cron job is run at 04:40am but this can be changed - if desired.
March 11, 201511 yr Author thanks, but i don't know how to write to cron.daily (directory?) can you optimize my go file and give me another hint? sorry to be such a noob.
March 11, 201511 yr thanks, but i don't know how to write to cron.daily (directory?) can you optimize my go file and give me another hint? sorry to be such a noob. cron.daily is a directory, any executable scripts in that directory will execute at 4:40 am (unless you change the daily time) What I'd suggest is writing a script called backup.sh (or whatever .sh you want) in it put something like this. #!/bin/bash rsync -avH --delete --stats --progress /mnt/user/Account rsync://r5-server-bckp/rsynced and so on... (the thing I don't know is if this will spawn multiple rsync instances at once or what... so I'm not positive that this is what you want the script to do exactly maybe someone else can help on this front. Then use chmod to make it executable, and drop it on your flash drive in a folder like /boot/custom Then in your go file you simply put #Run Backup (or whatever this is just to help remind you what it's doing...) cp /boot/custom/Backup.sh /etc/cron.daily The result will be that your Backup script will be copied into cron.daily on boot (cron.daily is a volatile location that is deleted on power down) and then will be run daily at the time daily con jobs are set to run. (If you don't want it to run daily you could set it in a different cron location)
March 11, 201511 yr Why do you have rsync -avH if you do not want the verbose output. the -v flag says give me verbose output. Also, do you want the logs or do you want to throw them away every day? There's more then one way to do this, but without knowing why the verbose request is being made and if you want ANY output it's hard to provide a best method to do this. There's a method to drop a script into /etc/cron.daily. There's a method to have a private crontab in /etc/cron.d where you define where the mail goes if any. By dropping a script in /etc/cron.daily you can have the output routed to syslog or a flat file that is overwritten every day or thrown away. By taking away the -v flag, you will not get verbose output, but you will get emailed for errors, which might be important. I.e. if the backup is failing, I would think someone wants to know.
March 11, 201511 yr Author as i posted at the beginning i don't want any mails. under 5.0.5 i don't get any so i copied the same string to 6beta14b and now i get all the complete logs for all the rsync cronjobs. thats the strange difference between the two versions. but you are right, that i want to know if something went wrong, so i will take away -v, hopefully it will quit mailing me everyday after every job.
March 11, 201511 yr thats the strange difference between the two versions. unRAID 5 does not have outbound email support without third party addons or plugins. unRAID 6 does. It's normal for cron to forward stdout and stderr via email. (I suppose you could consider unRAID 5 was really broke in it's lack of email support.)
March 13, 201511 yr Author me again. i tried to remove -v but i still get all the logs for completed and started tasks. how can i set it up with the go file to mail only when there are errors?
March 13, 201511 yr ok, now i updated to b6-14b sorry, i'm still new to the unix world. this is in my go file right now and its working on 5.0.5 and beta 6. but on 6 i get all the logs mailed to me. # Backup r5-server Folder to r5-server-bckp NAS crontab -l > /tmp/file; echo '# Run rsync at 5 am every day' >> /tmp/file; echo '00 5 * * * rsync -avH --delete --stats --progress /mnt/user/Account rsync://r5-server-bckp/rsynced' >>/tmp/file; crontab /tmp/file; rm /tmp/file crontab -l > /tmp/file; echo '# Run rsync at 5 am every day' >> /tmp/file; echo '00 5 * * * rsync -avH --delete --stats --progress /mnt/user/Audio rsync://r5-server-bckp/rsynced' >>/tmp/file; crontab /tmp/file; rm /tmp/file crontab -l > /tmp/file; echo '# Run rsync at 5 am every day' >> /tmp/file; echo '00 5 * * * rsync -avH --delete --stats --progress /mnt/user/Release rsync://r5-server-bckp/rsynced' >>/tmp/file; crontab /tmp/file; rm /tmp/file crontab -l > /tmp/file; echo '# Run rsync at 5 am every day' >> /tmp/file; echo '00 5 * * * rsync -avH --delete --stats --progress /mnt/user/Stock rsync://r5-server-bckp/rsynced' >>/tmp/file; crontab /tmp/file; rm /tmp/file how can i write a slimmer command to do all the jobs and not getting any mails instantly? Try this: crontab -l > /tmp/file.cron; cat >> /tmp/file.cron << EOT # Run rsync at 5 am every day 00 5 * * * rsync -aH --delete /mnt/user/Account rsync://r5-server-bckp/rsynced >/dev/null 2>&1 & 00 5 * * * rsync -aH --delete /mnt/user/Audio rsync://r5-server-bckp/rsynced >/dev/null 2>&1 & 00 5 * * * rsync -aH --delete /mnt/user/Release rsync://r5-server-bckp/rsynced >/dev/null 2>&1 & 00 5 * * * rsync -aH --delete /mnt/user/Stock rsync://r5-server-bckp/rsynced >/dev/null 2>&1 & EOT crontab /tmp/file.cron; rm /tmp/file.cron
March 24, 201511 yr Author Try this: crontab -l > /tmp/file.cron; cat >> /tmp/file.cron << EOT # Run rsync at 5 am every day 00 5 * * * rsync -aH --delete /mnt/user/Account rsync://r5-server-bckp/rsynced >/dev/null 2>&1 & 00 5 * * * rsync -aH --delete /mnt/user/Audio rsync://r5-server-bckp/rsynced >/dev/null 2>&1 & 00 5 * * * rsync -aH --delete /mnt/user/Release rsync://r5-server-bckp/rsynced >/dev/null 2>&1 & 00 5 * * * rsync -aH --delete /mnt/user/Stock rsync://r5-server-bckp/rsynced >/dev/null 2>&1 & EOT crontab /tmp/file.cron; rm /tmp/file.cron i did and its working perfect. thank you.
March 24, 201511 yr It's not a good idea to just throw away the output without squirreling it away somewhere. I might suggest redirecting the rsync output to a log file for each user share, the the cache drive or some other persistent area. Example: rsync -aH --delete /mnt/user/Account rsync://r5-server-bckp/rsynced > /mnt/user/Account/rsync.Account.log 2>&1 You can store the log anywhere where you can review it later on. /var/log/rsync.Account.log would work too or some other persistent area. By just throwing away the output, you never have a log to review and may never know something is going wrong.
Archived
This topic is now archived and is closed to further replies.