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 2008-08-30 21:10:22

dannygoh
New member
Registered: 2008-08-30
Posts: 3

Help on Cron & Rsync

I have this file on my editcron.sh

Code:

#!/bin/sh

CRONTXT=/mnt/HD_a2/crontab.txt

# start with existing crontab
/bin/crontab -l > $CRONTXT

# add the Rsync job to execute at 2:05 am - also create a logfile
/bin/echo "* */2 * * * /bin/sh /mnt/HD_a2/ffp/rsync-flux.sh" >> $CRONTXT

# install the new crontab
/bin/crontab $CRONTXT

# clean up
/bin/rm $CRONTXT

I have this file on /mnt/HD_a2/ffp/rsync-flux.sh

Code:

#!/bin/sh
cp -r /mnt/HD_a2/ffp/.ssh/ /home/root/
/mnt/HD_a2/ffp/bin/rsync -av root@xyz.com:/home/flux/completed /mnt/HD_a2/ >> /mnt/HD_a2/ffp/logs/rsync-flux.log
/bin/echo "#############################" >> /mnt/HD_a2/ffp/logs/rsync-flux.log

i check my rsync-flux.log and only "##############" is writing on the logs fine an not the line no 1 & 2?

pls help

Offline

 

#2 2008-08-30 23:21:22

ismora
Member
From: Paris, France
Registered: 2008-07-30
Posts: 30

Re: Help on Cron & Rsync

Maybe rsync fails, without writing anything on stdout (all messages printed to stderr).
So maybe try:

Code:

/mnt/HD_a2/ffp/bin/rsync -av root@xyz.com:/home/flux/completed /mnt/HD_a2/ >> /mnt/HD_a2/ffp/logs/rsync-flux.log 2>&1

Last edited by ismora (2008-08-30 23:21:41)


DNS-323 • 2x Hitachi 500MB • RAID1 • FW1.04 • ext3 • Fonz's v0.5 fun_plug
DNS-325 • 2x WD Green 2TB • RAID1 • FW?.?? • ext3 • Fonz's v0.7 fun_plug

Offline

 

#3 2008-08-31 06:19:05

dannygoh
New member
Registered: 2008-08-30
Posts: 3

Re: Help on Cron & Rsync

Thanks for the help. I now see the error message and I'm still stuck at my own command.

file on /mnt/HD_a2/ffp/rsync-flux.sh

Code:

#!/bin/sh
/mnt/HD_a2/ffp/bin/rsync -aPve ssh root@xyz.com:/home/flux/completed/sync /mnt/HD_a2/ >> /mnt/HD_a2/ffp/logs/rsync_flux.log 2>&1
/bin/echo "#############################" >> /mnt/HD_a2/ffp/logs/rsync_flux.log

I have this error in my logs file

Code:

rsync: Failed to exec ssh: No such file or directory (2)
rsync error: error in IPC code (code 14) at pipe.c(84) [receiver=3.0.3]
rsync: writefd_unbuffered failed to write 4 bytes [receiver]: Broken pipe (32)
rsync error: error in IPC code (code 14) at io.c(1544) [receiver=3.0.3]
#############################

when i run this command in telnet session, I can rsync my files.

Code:

/mnt/HD_a2/ffp/bin/rsync -aPve ssh root@xyz.com:/home/flux/completed/sync /mnt/HD_a2/ >> /mnt/HD_a2/ffp/logs/rsync_flux.log 2>&1

Offline

 

#4 2008-08-31 06:41:36

dannygoh
New member
Registered: 2008-08-30
Posts: 3

Re: Help on Cron & Rsync

I can answer my own question

i was missing rsync and ssh executable. here is the success file

Code:

#!/bin/sh
export SSH=/mnt/HD_a2/ffp/bin/ssh
export RSYNC=/mnt/HD_a2/ffp/bin/rsync

date=`date "+%Y%m%d-%H%M%S"`
/bin/echo $date >> /mnt/HD_a2/ffp/logs/rsync_flux.log
$RSYNC -aPve $SSH root@xyz.com:/home/flux/completed/sync /mnt/HD_a2/ >> /mnt/HD_a2/ffp/logs/rsync_flux.log 2>&1

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB