Révision 11 bin/zfs-snapshot

zfs-snapshot (revision 11)
8 8
   mkdir -p /mnt/snapshot
9 9
   if [ $? -eq 1 ]
10 10
   then
11
      echo "/!\\ Probleme lors de la creation de /mnt/snapshot /!\\"
11
      echo "/!\\ Probleme lors de la creation de /mnt/snapshot /!\\" 1>&2
12 12
      exit 1
13 13
   fi
14 14
fi
......
19 19
echo "**** $1"
20 20
if [ "$#" -eq 0 ]
21 21
then
22
   echo "/!\\ Le fichier de configuration est manquant /!\\"
23
   exit
22
   echo "/!\\ Le fichier de configuration est manquant /!\\" 1>&2
23
   exit 1
24 24
fi 
25 25

  
26 26
if [ ! -f $1 ]
27 27
then
28
   echo "/!\\ Le fichier de configuration n'existe pas /!\\" 
29
   exit
28
   echo "/!\\ Le fichier de configuration n'existe pas /!\\" 1>&2
29
   exit 1
30 30
fi
31 31
NAME_VOL=$(cat $1 |grep "name" |cut -d"=" -f2)
32 32
TYPE_ZFS=$(cat $1 |grep "type" |cut -d"=" -f2)
33 33
NB_SNAP=$(cat $1 |grep "nbsnapshots"|cut -d"=" -f2)
34 34
if [ "$NAME_VOL" = "" ] || [ "$TYPE_ZFS" = "" ] || [ "$NB_SNAP" = "" ]
35 35
then
36
   echo "/!\\ Probleme le fichier de configuration est incoherent ou incomplet /!\\"
37
   exit
36
   echo "/!\\ Probleme le fichier de configuration est incoherent ou incomplet /!\\" 1>&2
37
   exit 1
38 38
fi
39 39

  
40 40

  
......
59 59
   then
60 60
      echo "*** Mount en lecture seule de $NAME_VOL [OK]"
61 61
   else
62
      echo "/!\\ Probleme lors de la tentative de mount de $NAME_VOL sur /mnt/snapshot/$NAME_VOL /!\\"
63
      exit
62
      echo "/!\\ Probleme lors de la tentative de mount de $NAME_VOL sur /mnt/snapshot/$NAME_VOL /!\\" 1>&2
63
      exit 1
64 64
   fi
65 65
fi
66 66

  
......
92 92
umount /mnt/snapshot/$NAME_VOL
93 93
if [ $? -eq 1 ]
94 94
then
95
   echo "/!\\ Probleme lors du demontage du volume $NAME_VOL /!\\"
95
   echo "/!\\ Probleme lors du demontage du volume $NAME_VOL /!\\" 1>&2
96 96
fi
97 97

  
98 98
mount -o ro /dev/zvol/$NAME_VOL@snapshot-$ZDATE /mnt/snapshot/$NAME_VOL
......
102 102
   umount /mnt/snapshot/$NAME_VOL
103 103
   if [ $? -eq 1 ]
104 104
   then
105
      echo "/!\\ Probleme lors du demontage du volume $NAME_VOL /!\\"
105
      echo "/!\\ Probleme lors du demontage du volume $NAME_VOL /!\\" 1>&2
106 106
   fi
107 107

  
108 108
else
......
112 112
   then
113 113
      echo "*** Suppression du snapshot $NAME_VOL@snapshot-$ZDATE [OK]"
114 114
   else
115
      echo "/!\\ Suppression du snapshot $NAME_VOL@snapshot-$ZDATE [ERROR]. A TRAITER DANS LES PLUS BREFS DELAIS !!!"
115
      echo "/!\\ Suppression du snapshot $NAME_VOL@snapshot-$ZDATE [ERROR]. A TRAITER DANS LES PLUS BREFS DELAIS !!!" 1>&2
116 116
   fi
117 117
fi
118 118
#*** FIN ETAPE DE VERIFICATION ***#
......
139 139
   then
140 140
      echo "*** Suppression du snapshot $ID_SNAP_OLDER [OK]"
141 141
   else
142
      echo "/!\\ Suppression du snapshot $ID_SNAP_OLDER [ERROR]."
142
      echo "/!\\ Suppression du snapshot $ID_SNAP_OLDER [ERROR]." 1>&2
143 143
   fi
144 144

  
145 145
fi
......
149 149
echo "**** $1"
150 150
if [ "$#" -eq 0 ]
151 151
then
152
   echo "/!\\ Le fichier de configuration est manquant /!\\"
153
   exit
152
   echo "/!\\ Le fichier de configuration est manquant /!\\" 1>&2
153
   exit 1
154 154
fi 
155 155

  
156 156
if [ ! -f $1 ]
157 157
then
158
   echo "/!\\ Le fichier de configuration n'existe pas /!\\" 
159
   exit
158
   echo "/!\\ Le fichier de configuration n'existe pas /!\\" 1>&2
159
   exit 1
160 160
fi
161 161

  
162 162
NAME_VOL=$(cat $1 |grep "name" |cut -d"=" -f2)
......
164 164
NB_SNAP=$(cat $1 |grep "nbsnapshots"|cut -d"=" -f2)
165 165
if [ "$NAME_VOL" = "" ] || [ "$TYPE_ZFS" = "" ] || [ "$NB_SNAP" = "" ]
166 166
then
167
   echo "/!\\ Probleme le fichier de configuration est incoherent ou incomplet /!\\"
168
   exit
167
   echo "/!\\ Probleme le fichier de configuration est incoherent ou incomplet /!\\" 1>&2
168
   exit 1
169 169
fi
170 170

  
171 171
if [ "$TYPE_ZFS" == "volume" ]

Formats disponibles : Unified diff