Creating if statement for nfs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Creating if statement for nfs
# 1  
Old 06-21-2012
Creating nfs rsync script

What would be correct syntax in a script to check to see if a /export/nfs/home mount point is mounted and if not stop/abort? OS is Solaris 10 using standard VI ksh shell. Here is the script. Please tell me where you see the problem.
Code:
#!/bin/bash
#
# This script is run as root to sync AMI PROD to DR.
#
#

# Verify we are effectively root
#if ($> != 0){
#       warn "must be root to use this script\n";
#       usage();
#}

if [[ `grep -qs /export/nfs/home` /etc/dfs/sharetab ]]; then
    echo "filesystem mounted running rsync"
else
    echo "Aborted because filesystem not mounted"
    exit -1
fi

#Rotate log before beginning
/usr/local/bin/logrotate -f ./conf/logrotate.conf

#### Perform the rsync now ####

/usr/local/bin/rsync -anvz -e ssh --rsync-path=/usr/local/bin/rsync root@prod03:/export/nfs/home/ root@dr03:/export
/nfs/home/
~


Last edited by Franklin52; 06-21-2012 at 02:11 PM.. Reason: Please use code tags for data and code samples, thank you
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Solaris

NFS write error on host xyz: Stale NFS file handle - Solaris 10

Oct 13 12:19:15 xyz nfs: NFS write error on host xyz: Stale NFS file handle. Oct 13 12:19:15 xyz nfs: (file handle: 68000000 1bc5492e 20000000 377c5e 1ce9395c 720a6203 40000000 bdfb0400) Oct 13 12:19:15 xyz nfs: NFS write error on host zyz: Stale NFS file handle. Oct 13 12:19:15 xyz nfs: ... (5 Replies)
Discussion started by: psychocandy
5 Replies

2. Shell Programming and Scripting

Mount NFS Share On NFS Client via bash script.

I need a help of good people with effective bash script to mount nfs shared, By the way I did the searches, since i haven't found that someone wrote a script like this in the past, I'm sure it will serve more people. The scenario as follow: An NFS Client with Daily CRON , running bash script... (4 Replies)
Discussion started by: Brian.t
4 Replies

3. Shell Programming and Scripting

creating printf statement using user arguments

I am writing a script in bash and want to perform the operation I check number of arguments and make a print statement with the passes arguments If I pass 3 arguments I will do printf "$frmt" "$1" "$2" "$3"If I have 4 arguments I do printf "$frmt" "$1" "$2" "$3" "$4"etc (4 Replies)
Discussion started by: kristinu
4 Replies

4. UNIX for Dummies Questions & Answers

Permission Denied creating file under nfs mount

I have two servers, 82 and 70. My exports file on 82 reads / ...70(rw) on 70 I have a mountpoint called mnt_for_82 I execute on 70 mount -t nfs -o rw ...82:/ mnt_for_82 I go to server 70 and indeed can read and travers the mounted subdirectories. However, I try... (0 Replies)
Discussion started by: blaine.miller
0 Replies

5. Red Hat

Creating an NFS Installation Server

Hello I am working through the RHCE Linux Study Guide (Michael Jang) and part of the course is learning how to configure a network installation. The first procedure is to copy the files from the Installation DVD to a new directory I created as follows: # mkdir /inst The problem I'm... (2 Replies)
Discussion started by: tjwops
2 Replies

6. Solaris

All dependicies of nfs service is online but nfs is offline

Hi all in my server all nfs dependices are online but nfs client is offline root@BIWAPP1 # svcs -a|grep nfs disabled Sep_05 svc:/network/nfs/server:default online Sep_05 svc:/network/nfs/rquota:default online Sep_05 svc:/network/nfs/mapid:default online ... (9 Replies)
Discussion started by: spandhan
9 Replies

7. Shell Programming and Scripting

Creating a dynamic case statement

I'm using the korn shell and trying to create a case statement from the contents of a file that is changed regularly, each line of the file has three fields, eg track1 202.111.111.111 99 room7 222.111.222.333 76 I'm using awk to select each variable. I've been unable to figure out how to... (5 Replies)
Discussion started by: squrcles
5 Replies

8. Shell Programming and Scripting

Creating an sql statement from a file. Problem with '

Hi, I am trying to create sql statements from a file, but I have a problem with ': This is what I do: cat filex.txt | awk -F: '{print $1,"A","and personnavn like",$5}' | sed -e "s/^/select bruker.brukernavn, person.personnavn from bruker, person where brukernavn like '/" -e "s/$/' and... (2 Replies)
Discussion started by: hannem
2 Replies

9. Solaris

NFS write error on host : Stale NFS file handle

:confused:Hi all When i see in the /var/adm/messages, i saw the following error unix: NFS write error on host : Stale NFS file handle. unix: (file handle: 45ca415 3e7 a0000 2c7f6 3ebfc25f a0000 2 3e49) It is using sunOS 5.7. Is anybody know what is this error? Is is related to any network... (2 Replies)
Discussion started by: AirWalker83
2 Replies
Login or Register to Ask a Question