Backup script in ksh


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Backup script in ksh
# 1  
Old 03-06-2014
Backup script in ksh

I need a script in ksh that
-automatically connect to computers in a network and identify directories in remote computers
-then mount directories on to the local host where the script is runned
-then backup directories in the local host and the remote systems one by one using tar command (to archive) on to local host.
# 2  
Old 03-06-2014
What have you tried? Where are you stuck?
# 3  
Old 03-06-2014
Is this homework?
# 4  
Old 03-08-2014
I have a script that takes input from the user for path and IP.....but i need a script that automatically mount directories form remote systems.
# 5  
Old 03-08-2014
Only NFS-exported file systems can be mounted.
If you have Solaris/Linux/HP-UX automounter running and /net -hosts in /etc/auto.master (or /etc/auto_master), you should be able to discover and backup the exported NFS, like this example
Code:
date=`date +%Y-%m-%d-%H-%M`
cd /net || exit
tar cf /path/to/archive/$date.tar remotehost1 remotehost2

Or a loop
Code:
date=`date +%Y-%m-%d-%H-%M`
cd /net || exit
for h in remotehost1 remotehost2
do
  tar cf /path/to/archive/$h.$date.tar $h
done

This User Gave Thanks to MadeInGermany For This Post:
# 6  
Old 03-10-2014
I have this script and i'm getting some error....please check and let me know if any corrections have to made

Code:
#!/bin/ksh

MOUNT=/bin/mount
UMOUNT=/bin/umount

DEST_PATH=/bin/backup

GetPathRemote(){
for ip in 192.168.1.{1..254};
do
if[ nc -zv $ip 22 2>$1 | grep succeeded ];
then
ksh $ip "ISMOUNTED=`$MOUNT | grep "/mntback"`"
fi

if[ ! "$ISMOUNTED"="" ];
then
mkdir/mntback
fi

DEST_NAME=backup

DEST_PATH=/mntback/$DEST_NAME

CreateArch
$UMOUNT/mntback
done
}

# 7  
Old 03-10-2014
What error?
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Shell script to call Oracle archive backup script when file system reaches threshold value

Hello All, I need immediate help in creating shell script to call archivebkup.ksh script when archive file system capacity reaches threshold value or 60% Need to identify the unique file system that reaches threshold value. ex: capacity ... (4 Replies)
Discussion started by: sasikanthdba
4 Replies

2. Shell Programming and Scripting

Help with Backup Shell Script for Network Device Configuration backup

HI all, im new to shell scripting. need your guidence for my script. i wrote one script and is attached here Im explaining the requirement of script. AIM: Shell script to run automatically as per scheduled and backup few network devices configurations. Script will contain a set of commands... (4 Replies)
Discussion started by: saichand1985
4 Replies

3. Shell Programming and Scripting

Need help in creating file restoration script from a backup script.

Hi all i am struggling in creating a restore of env files while doing applications clone. the first file i created for copying the important configurations file which is running perfect now for reverting the changes i mean when i am restoring these files to its original places i have to do... (7 Replies)
Discussion started by: javeedkaleem
7 Replies

4. Shell Programming and Scripting

rsync backup mode(--backup) Are there any options to remove backup folders on successful deployment?

Hi Everyone, we are running rsync with --backup mode, Are there any rsync options to remove backup folders on successful deployment? Thanks in adv. (0 Replies)
Discussion started by: MVEERA
0 Replies

5. Shell Programming and Scripting

Help with Backup Shell Script 'ksh + awk over ssh'

Hi newbeeeee alarm i want to send a little script over ssh this script mus download a report.tar then rename and move. the report name format is report_<host.with.dot>-10-09-20-11:55:25.tar function remote_cmd_mv { _host=$1 ARCHROOTDIR='/tmp' ... (8 Replies)
Discussion started by: TigerGoods
8 Replies

6. Shell Programming and Scripting

KSH script to run other ksh scripts and output it to a file and/or email

Hi I am new to this Scripting process and would like to know How can i write a ksh script that will call other ksh scripts and write the output to a file and/or email. For example ------- Script ABC ------- a.ksh b.ksh c.ksh I need to call all three scripts execute them and... (2 Replies)
Discussion started by: pacifican
2 Replies

7. Shell Programming and Scripting

import var and function from ksh script to another ksh script

Ih all, i have multiples ksh scripts for crontab's unix jobs they all have same variables declarations and some similar functions i would have a only single script file to declare my variables, like: var1= "aaa" var2= "bbb" var3= "ccc" ... function ab { ...} function bc { ... }... (2 Replies)
Discussion started by: wolfhurt
2 Replies

8. Shell Programming and Scripting

tracing a ksh script within a ksh script

I normally trace a script with the ksh -x <script name> and redirect strderr to file. But if you have a script like the examble below...... vi hairy bear=`grep bear animals` if then ksh more_animals fi If I ksh -x hairy it won't trace "more_animals" unless I put a -x in it. Is... (1 Reply)
Discussion started by: shorty
1 Replies

9. Shell Programming and Scripting

executing a ksh script from another ksh script

Hi, I'm new to unix scripting.How can i call a script from another script. I have a.ksh and b.ksh .I have to call b.ksh from a.ksh after it is successfully exceuted. I tried using #!/bin/ksh -x in a.ksh and at the end i have used /path/b.ksh My problem is it is executing only a.ksh.it... (6 Replies)
Discussion started by: ammu
6 Replies
Login or Register to Ask a Question