LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Question of syntax (https://www.linuxquestions.org/questions/linux-software-2/question-of-syntax-723936/)

kaplan71 05-05-2009 01:55 PM

Question of syntax
 
Hi there --

The code listed below is an excerpt from a script that I am writing. The goal is to verify that a directory on a remote server is available to the local system. If that is not the case, a log file is written, and all filesystems that were previous unmounted, are remounted on the local system.

Code:

# # Unmount all NFS mounts prior to the archive process.
umount -a -t nfs

# Mount the remote directory (NFS) prior to running the make_net_recovery script.
# Make sure there is a <remote server> folder located in the /mnt directory. If it is
# not already there, create one.
mount <remote server>:/<local system> /mnt/<remote server>

# Verify the remote directory (NFS) is available. This directory is needed
# as it is the destination for the iso images. If it is not available, stop
# here, and write the results to a log file.
df |grep <remote server> > /dev/null
RC=$?
echo $RC

if [ ${RC} -eq 0 ]
then
echo successful
else
echo not successful >> /tmp/make_net_backup.log && mount -a
exit
fi

Is the syntax shown above correct? Thanks.

pixellany 05-05-2009 02:45 PM

Why not try it???

If something does not work, then add diagnostic code as necessary (eg "echo $somevariable")


All times are GMT -5. The time now is 12:48 PM.