-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsrsetinit.sh
More file actions
63 lines (60 loc) · 1.95 KB
/
srsetinit.sh
File metadata and controls
63 lines (60 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#! /bin/sh
###Begin Info
# Name : srsetinit
# Short-Description : prepare the work mode of SR
# Author / Copyright : Gian Giovani <wejick@gmail.com> wejick.wordpress.com
### END Info
. /etc/sisrestore.conf
if [ $bsdmod -eq 0 ]; then
chmod 744 $INITPATH/sisrestore
if [ $wmode -eq 1 ]; then
if [ -x /etc/rcS.d/S38sisrestore ]; then
mv /etc/rcS.d/S38sisrestore /etc/rcS.d/K38sisrestore
fi
if [ -r /etc/rc0.d/K01sisrestore ]; then
mv /etc/rc0.d/K01sisrestore /etc/rc0.d/S01sisrestore
fi
if [ ! -x /etc/rc0.d/S01sisrestore ]; then
chmod 744 /etc/rc0.d/S01sisrestore
fi
elif [ $wmode -eq 2 ]; then
if [ -x /etc/rc0.d/S01sisrestore ]; then
mv /etc/rc0.d/S01sisrestore /etc/rc0.d/K01sisrestore
fi
if [ -r /etc/rcS.d/K38sisrestore ]; then
mv /etc/rcS.d/K38sisrestore /etc/rcS.d/S38sisrestore
fi
if [ ! -x /etc/rcS.d/S38sisrestore ]; then
chmod 744 /etc/rcS.d/S38sisrestore
fi
elif [ $wmode -eq 3 ]; then
if [ -x /etc/rcS.d/S38sisrestore ]; then
mv /etc/rcS.d/S38sisrestore /etc/rcS.d/K38sisrestore
fi
if [ -x /etc/rc0.d/S01sisrestore ]; then
mv /etc/rc0.d/S01sisrestore /etc/rc0.d/K01sisrestore
fi
else
echo "$(date +%F===%H:%m:%S) Operation failed. See documentation. Init script setup failure" >> $log_file
echo "Operation failed. See documentation. Init script setup failure"
fi
elif [ $bsdmod -eq 1 ]; then
if [ $wmode -eq 1 ] || [ $wmode -eq 2 ]; then
if [ -f $INITPATH/sisrestore ]; then
chmod 774 $INITPATH/sisrestore
else
echo "$INITPATH/sisrestore not exist"
fi
elif [ $wmode -eq 3 ]; then
if [ -f $INITPATH/sisrestore ]; then
chmod 644 $INITPATH/sisrestore
else
echo "$INITPATH/sisrestore not exist"
fi
else
echo "$(date +%F===%H:%m:%S) Operation failed. See documentation. Init script setup failure" >> $log_file
echo "Operation failed. See documentation. Init script setup failure"
fi
else
echo >> "$(date +%F===%H:%m:%S) sisrestore did not understand value of bsdmod" >> $log_file
fi