DON'T PANIC

Shell scripting

./synchronize_home.sh

#!/bin/bash
# Next script allows to sychronize configurations from a host, where is running this script, to another one.

HOME_PATH=/home/bcls
RSYNC_PATH=/usr/bin/rsync

echo " Enter rsync destination "
read IP_DESTINATION=''
ping -c 1 $IP_DESTINATION
if [ $? != 0 ]; then
echo " '$IP_DESTINATION' does not exist. Check this."
exit 0
fi

cd HOME_PATH
if [ $? != 0 ]; then
echo " '$HOME_PATH' does not exist. Check this."
exit
fi

$RSYNC_PATH --recursive --archive --update --verbose .config bcls@IP_DESTINATION:$HOME_PATH/
if [ $? = 0 ]; then
MSG_OK=`echo Rsync has not finished correctly.`
else
MSG_ERROR=`echo Rsync has finished properly. Check this.`
exit
fi

Advertisements

1 Response to "Shell scripting"

Nice, but I would change it to include more directories. Like my .mozilla and .kde4 by using .{config,mozilla,kde4} instead of just .config .

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


  • analialorenzatto: Buzz is just a host name for this example, it doesn't have any relation to the topic. Instead of being "Buzz", could be whatever name.
  • fridelain: >buzz What's the story behind this host name? Actully running buzz, once running buzz and upgraded many times since, or unrelated to debian naming
  • Pratik: Nice, but I would change it to include more directories. Like my .mozilla and .kde4 by using .{config,mozilla,kde4} instead of just .config .

Categories

%d bloggers like this: