You are not logged in.
Pages: 1
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
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
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
Well I just meant that you should run bash scriptname in your terminal and look at the output.
Offline
#!/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
if? ;-)
Please try to understand what a script does before blindly running it. Go through any bash tutorial. It will take just five minutes.
Offline
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
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
Pages: 1