My task is to login to a remote Solaris server,cd into a directory and execute a backup shell script and scp the log files to a directory on workstation many miles away.I donot know where or how to start.Any assistance is appreciated
Write a script on the remote Solaris server to do everything and call the script remotely with the "rsh" command (see "man rsh". If the workstation where the log files are supposed to end up is a Unix workstation then your script can copy the files there with "rcp" (see "man rcp".
1) do you already have the backup script on the remote server ?
2) I see you have scp so I'll assume you have ssh (secure shell) If so you can do ssh user@remoteserver name_of_backup_script.sh
This will prompt you for the users password and then run the backup script.
3) Depending on how your backup script works (lets say it creates a tar file [fred08012003.tar]) then you can have another script (or as part of the backup) to ftp the file to you.
ssh user@remoteserver name_of_backup_script.sh; ftp_script.sh
If thats the case why login? just set a crontab to run the two scripts for you!
AND FINALLY:
4) if you have neither 1, 2, 3 then "allthough very basic" maybe these will help:
------------------------------------------------------------
Weekly_backup.sh
#!/bin/ksh
#
# NAME: Weeklybackup.sh
# TASK: To do level 0 backup
# CODE: Laurie Baker
#
# To Rewind the tape add...
#
# mt -f /dev/rmt/0 rewind
#
# Back up the local disks /, /usr, /.bigpart, /opt
#
#
# Set-up the lists of volumes to backup
#
UFSDUMPLISTLOCAL="/ /usr /.bigpart /opt"
echo " ¬¬¬ CAUTION! ¬¬¬"
echo " ****** SYSTEM BACKUP IN PROCESS ******"
echo "+++++++ LAurie BAker ++++++++"
for i in `echo $UFSDUMPLISTLOCAL`
do
echo "****** $i ******"
/usr/sbin/ufsdump 0fcu /dev/rmt/0cn $i >> $DUMPLOG 2>&1
done
# Note: change device if writing to disk
#
# Backup the shared disks
#
for i in `echo $VXDUMPLISTLOCAL`
do
echo "****** $i ******"
/usr/sbin/vxdump -0fcus /dev/rmt/0cn 87040 $i >> $DUMPLOG 2>&1
done
#
# Backup other local disks (uncomment if required)
#
# for i in /etc/opt/SUNWcluster/conf/ccdssa
# do
# echo "****** $i ******"
# /usr/sbin/ufsdump 0fcu /dev/rmt/0cn $i >> $DUMPLOG 2>&1
# done
mt rewoffl
# Uncomment next line to reboot if required
#/usr/sbin/init 6
-----------------------------------------------------------
NOTE this backup is for output to tape so needs changing if you need to write to disk :¬)
AND
------------------------------------------------------------
FTP_TO_HOME.sh
#!/bin/sh
Date=`/usr/bin/date '+%Y%m%d'`
Filelocation=/path_to/backup.file
host=someftphost.com
local=/u01/backups
login_name=someuser
password=somepassword
cp $Filelocation $local/$Date.backup
/usr/bin/gzip $local/*
cd $local
ftp -v -n $host << EOF
user $login_name $password
prompt
bin
mput *
quit
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.