You are not logged in.

#1 2009-01-25 12:33:03

okplayer02
Member
From: Denver, Colorado
Registered: 2008-11-24
Posts: 84

rsync and crontab (solved)

i am trying to use a script i found on the wiki for rsync to back up specific directories on my laptop to my server

here is the script

#!/bin/bash
if ping -c 1 -w 5 homer > /dev/null ; 
rsync -vra -rsh='ssh -p 7935' --delete /home/hakim/memorabilia/ noordin@homer:/extra/memorabilia/
rsync -vra -rsh='ssh -p 7935' --delete /home/hakim/python_tutorials/ noordin@homer:/extra/python_tutorials/
else
echo echo  backup failed `date` >> ~/RsyncBackupLog
fi

now i have crond rsyncd sshd all running on my laptop

and the script never runs its not even a record of it starting in the log
and i am running this in the normal user also the ssh is configured for a no password properly

when i run the rsync commands from terminal it works fine.

any help i would appreciate

Last edited by okplayer02 (2009-01-25 14:55:30)


Say what is good or keep silent  --Prophet Muhammad (SAW)

Offline

#2 2009-01-25 13:14:29

Morra
Member
Registered: 2008-05-16
Posts: 39

Re: rsync and crontab (solved)

Things I noticed:

#!/bin/bash
if ping -c 1 -w 5 homer &> /dev/null ; then
rsync -vra --rsh='ssh -p 7935' --delete /home/hakim/memorabilia/ noordin@homer:/extra/memorabilia/
rsync -vra --rsh='ssh -p 7935' --delete /home/hakim/python_tutorials/ noordin@homer:/extra/python_tutorials/
else
echo backup failed `date` >> ~/RsyncBackupLog
fi

Did you test the script or only rsync commands? If the script works then you need to take a look at the cron daemon.

Offline

#3 2009-01-25 13:19:15

okplayer02
Member
From: Denver, Colorado
Registered: 2008-11-24
Posts: 84

Re: rsync and crontab (solved)

well i did just test the commands by themselves

how can i go about testing the script


Say what is good or keep silent  --Prophet Muhammad (SAW)

Offline

#4 2009-01-25 13:25:53

Morra
Member
Registered: 2008-05-16
Posts: 39

Re: rsync and crontab (solved)

Well I just meant that you should run bash scriptname in your terminal and look at the output.

Offline

#5 2009-01-25 13:44:59

okplayer02
Member
From: Denver, Colorado
Registered: 2008-11-24
Posts: 84

Re: rsync and crontab (solved)

#!/bin/bash
ping -c 1 -w 5 homer > /dev/null then
rsync -vrae 'ssh -p 7935' --delete /home/hakim/memorabilia/ noordin@homer:/extra/memorabilia/
rsync -vrae 'ssh -p 7935' --delete /home/hakim/python_tutorials/ noordin@homer:/extra/python_tutorials/
else
echo backup failed `date` >> ~/RsyncBackupLog
fi

ok i test the script it says this

rsync.sh: line 5: syntax error near unexpected token `else'
rsync.sh: line 5: `else'

thats the error message about syntax error


Say what is good or keep silent  --Prophet Muhammad (SAW)

Offline

#6 2009-01-25 14:25:25

u_no_hu
Member
Registered: 2008-06-15
Posts: 453

Re: rsync and crontab (solved)

if? ;-)

Please try to understand what a script does before blindly running it. Go through any bash tutorial. It will take just five minutes.


Don't be a HELP VAMPIRE. Please search before you ask.

Subscribe to The Arch Daily News.

Offline

#7 2009-01-25 14:36:23

okplayer02
Member
From: Denver, Colorado
Registered: 2008-11-24
Posts: 84

Re: rsync and crontab (solved)

alright fair enough i did miss that part in the scripüt and i know it takes 5 mins

i didnt notice i left that part out was in a rush

so calm down fella

i  understand the commands and what they are doing i just got lil confused about the syntax its common sensse i see

like i say was in a rush and doing other things

Last edited by okplayer02 (2009-01-25 14:40:43)


Say what is good or keep silent  --Prophet Muhammad (SAW)

Offline

#8 2009-01-25 14:54:24

okplayer02
Member
From: Denver, Colorado
Registered: 2008-11-24
Posts: 84

Re: rsync and crontab (solved)

well  i solved it by not only placing if but

putting a ; after  null


Say what is good or keep silent  --Prophet Muhammad (SAW)

Offline

Board footer

Powered by FluxBB