DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2011-10-28 20:43:59

ottsm
Member
Registered: 2010-12-23
Posts: 44

RSYNC how to get multiple log files

Anyone have a good command line for RSYNC and CRON (this is for a DNS325 thus the extra /HD/, I also have a DNS323).

I use the following to backup files every night at 2:05, problem is the log is overwritten each time;
5 2 * * * /mnt/HD/HD_a2/ffp/bin/rsync -ai --stats --delete /mnt/HD/HD_a2/ /mnt/HD/HD_b2 >/mnt/HD/HD_a2/ffp/log/rsync.last.log 2>&1

What I'd like to do is have the rsync.last.log file be the last seven days.  It's been years since I did a lot of programming and that was in microware OS9 which is similar to linux but the commands are slightly different.  I want to append and pipe the day of the week (1-7) to the end of rsync.last?.log where ? would be the day number or even the month if need be.  This way I can go back and look what files were logged if I didn't get a chance to look for several days.

Offline

 

#2 2011-10-28 21:58:23

scaramanga
Member
Registered: 2010-08-04
Posts: 251

Re: RSYNC how to get multiple log files

To generate different log file names for each day of the week - the date command is your friend.

Code:

... /mnt/HD/HD_a2/ffp/log/rsync.last$(date "+%u").log 2>&1

Try

Code:

date --help

for more details.


DNS-323 HW Rev. C1 FW 1.10 fun-plug 0.5
2 x WD10EARS-00Y5B1 in Standard mode (LCC set to 5 min; Aligned to 4K)
Transmission with Transmission Remote GUI

Offline

 

#3 2011-10-28 23:01:36

ottsm
Member
Registered: 2010-12-23
Posts: 44

Re: RSYNC how to get multiple log files

Thanks, that will get me started.

Offline

 

#4 2011-10-28 23:03:37

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: RSYNC how to get multiple log files

you could also install logrotate.


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#5 2013-01-15 23:34:13

tniet
New member
Registered: 2012-02-22
Posts: 4

Re: RSYNC how to get multiple log files

I have read that the DNS-325 overwrites the CRONTAB entries if you access the web interface, but can't find any info on how to get around this.  What did you do to create your crontab and maintain it between web accesses and reboots?

Offline

 

#6 2013-01-16 03:12:31

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: RSYNC how to get multiple log files

Personally, I never use the web UI for changes any more. The settings only get overwritten if you access the share setup. Easy to avoid. I also reset the cron jobs as part of nightly maintenance.


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#7 2013-01-25 02:38:06

ottsm
Member
Registered: 2010-12-23
Posts: 44

Re: RSYNC how to get multiple log files

This is an old thread of mine but now I'm having a problem with a DNS 345, my cron jobs just disappears even though I didn't reboot.  Is driving me crazy trying to figure out what it is.  I've logged into the web UI and it didn't get rid of the cron jobs.  I just added a 3 minute sleep delay to the cronedit.sh file, someone mentioned this but I don't see how this could be the problem because I'm not rebooting and I don't have a problem on bootup.  Unless a soft boot of some type is being done that is faster and the cronedit.sh ends up too early. 

below is what my rsync cron looks like.

5 3 * * * /mnt/HD/HD_a2/ffp/bin/rsync -aiH8 --stats --delete "/mnt/HD/HD_a2/Data Files" "/mnt/HD/HD_b2" >/mnt/HD/HD_a2/ffp/log/rsync.last$(date "+%u").log 2>&1

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB