Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need help with easy script 1

Status
Not open for further replies.

call

Technical User
Oct 31, 2000
127
US
Here is what im looking to do.

unmount a filesystem
then have it run a backup of that file system
then mount the file system


The command to run the backup is /usr/sbin/backup -f'/dev/rmt0' -'0' /filename
can anybody help.
thank you
 
call,

if you're trying an i-node backup use :

backup -0 -f /dev/rmt0 /filename

... hope this works.

 
This is for a standalone

and i want to write a scritp and in the script

I need to have it unmount a single file system like /jsun only

then i need it to backup the file system ... i just unmounted I have that command aready

then after backup runs I need the script to mount the file system back.

can someone tell me how to write the script.
thank you
 
Ok.

Hope I'm not just being obvious here, maybe I'm missing something implied in your question. The script below will return:

0 - success
1 - couldn't unmount the file system
2 - backup failed
3 - couldn't mount the file system afterwards
[tt]
#!/bin/ksh

FS=$1; shift # get the name of the filesystem from the command line
umount $FS
rc=$?
if [[ $rc != 0 ]]
then
exit 1
fi

/usr/sbin/backup -f'/dev/rmt0' -'0' $FS
rc=$?
if [[ $rc != 0 ]]
then
exit 2
fi

mount $FS
rc=$?
if [[ $rc != 0 ]]
then
exit 3
fi

exit 0
[/tt]


Anyone see any typos? (I'm at home, no unix here (yet))
Mike
michael.j.lacey@ntlworld.com
Email welcome if you're in a hurry or something -- but post in tek-tips as well please, and I will post my reply here as well.
 
Look at using the <fuser -k> command to kill processes that have a filesystem/LV open (or maybe to simply identify those processes) - this is if normal application shutdown does not work. I give Oracle the time that the DBA's request, then if Oracle is still not down, then the processes are killed so that I may unmount the filesystems.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top