Added client work scripts
[clearscm.git] / clients / HP / bin / mountlvm
1 #!/bin/ksh
2 ################################################################################
3 #
4 # File:         mountlvm
5 # Description:  This script will mount a project's logical volumes
6 # Author:       Andrew DeFaria (defaria@cup.hp.com)
7 # Language:     Korn Shell
8 # Modifications:
9 #
10 # (c) Copyright 2001, Andrew@DeFaria.com, all rights reserved
11 #
12 ################################################################################
13 me=$(basename $0)
14 if [ $(id -u) -ne 0 ]; then
15   print -u2 "$me: Error: You must be root to execute this command!"
16   exit 1
17 fi
18
19 if [ $# -ne 2 ]; then
20   print -u2 "Usage: $me projectID fileserver"
21   exit 1
22 fi
23
24 projectID=$1
25 fileserver=$2
26
27 function create_dir_and_mount {
28   machine=$1
29   mount_directory=$2
30   mount_over_directory=/tmp_mnt/net/$machine$2
31   if [ ! -d $mount_over_directory ]; then
32     print Making $mount_over_directory
33     mkdir -p $mount_over_directory
34   fi
35
36   if [ ! -d $mount_over_directory/lost+found ]; then
37     print Mounting $machine:$mount_directory to $mount_over_directory
38     /usr/sbin/mount $machine:$mount_directory $mount_over_directory
39   fi
40 } # create_dir_and_mount
41
42 function kick_automounter {
43   automount_pid=$(/app/sj automount | awk '{print $2}')
44
45   print Kicking automounter \($automount_pid\)
46   kill -HUP $automount_pid
47 } # kick_automounter
48
49 create_dir_and_mount cllvu01 /CLO/Storage/Views/$projectID
50 create_dir_and_mount cllvu02 /CLO/Storage/Views/$projectID
51 create_dir_and_mount cllvu03 /CLO/Storage/Views/$projectID
52 create_dir_and_mount $fileserver /data/proj/$projectID
53
54 kick_automounter