-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtotal-scan.sh
More file actions
54 lines (47 loc) · 1.42 KB
/
total-scan.sh
File metadata and controls
54 lines (47 loc) · 1.42 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
#!/bin/bash
#
# check whether /tmp/cis created
TEMP_DIR=/tmp/cis
LOG_DIR=`pwd`"/log-"`hostname`
echo -e "Checking $TEMP_DIR directory...\c"
if [ ! -d $TEMP_DIR ]
then
echo -e "\nCreating $TEMP_DIR directory...\c"
/bin/mkdir -p $TEMP_DIR || (echo -e "\nFailed to create $TEMP_DIR, Exiting... "; exit 1)
fi
echo -e "\tDONE"
#
# check whether any step files are in current dir
echo -e "Checking script library in" `pwd`"...\c"
for file in backup check step
do
(ls *sh | grep $file > /dev/null) || (echo -e "\nMissing $file script, Exiting ..."; exit 1)
done
echo -e "\tDONE"
echo -e "Checking $LOG_DIR directory...\c"
if [ ! -d $LOG_DIR ]
then
echo -e "\nCreating $LOG_DIR directory...\c"
/bin/mkdir -p $LOG_DIR || (echo -e "\nFailed to create $LOG_DIR, Exiting... "; exit 1)
fi
echo -e "\tDONE"
for file in ./do-backup.sh `/bin/ls ./step*sh`
do
echo -e "\n***" Running $file "...\c";
$file 1> $LOG_DIR/${file%sh}"log" 2>&1
echo -e "\t\tDONE"
while read -s -n1 -p "Continue or see log? [y|n|l]" key
do
if [[ $key == 'n' || $key == 'N' ]]; then
echo "Exiting..."; exit 0
elif [[ $key == 'y' || $key == 'Y' ]]; then
break;
elif [[ $key == 'l' || $key == 'L' ]]; then
echo "\n----------$file LOG---"
cat $LOG_DIR/${file%sh}"log"
echo "----------end of LOG----"
else echo "wrong key"; fi
done
done
echo -e "\nRun Fingerprint script after you are done with"
echo "system modification"