You are here: User Guide > Using LifeKeeper Linux > Advanced Tasks > Sample Restore Script

Sample Restore Script

The following example provides the functional processing section of a file system restore script:

70 getchildinfo() {

71 OKAPP=$1

72 PTAG=$2

73 ret=1

74 if $LKROOT/bin/dep_list -c $PTAG | sed "s//_/g; s//_/g" >/tmp/DL$$

75 then

76 for i in `cat /tmp/DL$$`

77 do

78 l=`echo "$i" | sed "s/_/ /g; s/_/ /g"`

79 CHDTAG=`echo "$l" | cut -d_ -f2`

80 if CHDDATA=`$LKROOT/bin/ins_list -t$CHDTAG`

81 then

82 APP=`echo "$CHDDATA" | cut -d_ -f2`

83 if [ "$OKAPP" != "$APP" ]

84 then

85 continue

86 fi

87 ret=0

88 break

89 fi

90 done

91 fi

92 if [ "$ret" != 0 ]

93 then

94 pl "LifeKeeper: *ERROR* getchildinfo found no $OKAPP child for $PTAG"

95 fi

96 return $ret

97 }

98

99 pl "LifeKeeper: mounting file system $FSNAME"

100

101 # Check if the filesystemfile system exists

102 f=`sed -n "\?^.* $FSNAME ?p" /etc/mnttab`

103 if [ "$f" != "" ]

104 then

105 pl "LifeKeeper: file system $FSNAME already mounted"

106 err=0

107 exit 0

108 fi

109

110 if v=`$LKROOT/bin/ins_list -t"$TAG"`

111 then

112 if getchildinfo scsi $TAG

113 then

114 CTAG=$CHDTAG

115 else

116 exit 1

117 fi

118

119 # Get the mount information

120 INFO=`echo "$v" | cut -d_ -f6`

121 FSTYPE=`echo "$INFO" | cut -d_ -f1`

122 FSPERM=`echo "$INFO" | cut -d_ -f2`

123

124 fp=`echo "$CHDDATA" | cut -d_ -f5`

125 FPName=/dev/dsk/$fp

126 FPRawName=/dev/rdsk/$fp

127

128 # Test for root filesystemfile system

129 test $FSNAME = /

130 if [ "$?" -eq 0 ]

131 then

132 ROOT=1

133 else

134 ROOT=0

135 fi

136

137 # If root filesystemfile system: return code 0 means it is OK and mounted

138 if [ "$ROOT" -eq 1 ]

139 then

140 err=0

141 exit 0

142 else # If other than root filesystemfile system, mount it

143 if [ ! -d $FSNAME ]

144 then

145 mkdir $FSNAME

146 if [ $? != 0 ]

147 then

148 pl "LifeKeeper: can't make file system $FSNAME mount point"

149 exit 1

150 fi

151 fi


© 2012 SIOS Technology Corp., the industry's leading provider of business continuity solutions, data replication for continuous data protection.