•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the Shell Scripting section within the Software Development category of DaniWeb, a massive community of 456,423 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,615 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Shell Scripting advertiser: Programming Forums
Views: 2931 | Replies: 2
![]() |
•
•
Join Date: Mar 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
Hello Freinds,
I am in need of a shell script whiich rsyncs a folder from a server to my machine. My major concern is not a script that rysnc's but it should send a mail if the rsync failed for some reason while copying the files.. For example the remote server might go down in the middle of the copying or my machine can also be down.
How can i impliiment this? I hope i would get some help from you guys..
Looking for your updates..
Thanks,
Santhosh
I am in need of a shell script whiich rsyncs a folder from a server to my machine. My major concern is not a script that rysnc's but it should send a mail if the rsync failed for some reason while copying the files.. For example the remote server might go down in the middle of the copying or my machine can also be down.
How can i impliiment this? I hope i would get some help from you guys..
Looking for your updates..
Thanks,
Santhosh
•
•
Join Date: Jan 2007
Posts: 10
Reputation:
Rep Power: 2
Solved Threads: 0
Here's a quick one to get you started:
Obviously, you need to plug in the email portion...
I always throw in -z for rsync for the added compression benefit, and I also always use -e ssh to send it over SSH so it's encrypted.
HTH
-Josh
#!/bin/bash
rsync -aze ssh username@server:/path/on/remote/box /local/path 2> /home/err.log
if [ -s /home/err.log ] ; then
# file is not empty, some error has occured, do your email here
echo "error occured!" ;
else
echo "no error occured, everything went fine!" ;
fiObviously, you need to plug in the email portion...
I always throw in -z for rsync for the added compression benefit, and I also always use -e ssh to send it over SSH so it's encrypted.
HTH
-Josh
![]() |
•
•
•
•
•
•
•
•
DaniWeb Shell Scripting Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Similar Threads
- Convert shell script for looping (Shell Scripting)
- Problem with variables in Windows shell script (Windows NT / 2000 / XP / 2003)
- Using find in a bash shell script (Shell Scripting)
- Shell Script for Gnome 2.6 Print Manager. (Shell Scripting)
- How to su properly in a shell script (Shell Scripting)
Other Threads in the Shell Scripting Forum
- Previous Thread: File ext rename
- Next Thread: Problem with recursion in subdirectories


Linear Mode