-
Notifications
You must be signed in to change notification settings - Fork 0
/
check-extra.sh
executable file
·44 lines (43 loc) · 1.18 KB
/
check-extra.sh
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
#!/bin/bash
NAME=`basename $( dirname ${BASH_SOURCE[0]} )`
if [ "${NAME}" == "." ]; then
NAME=`basename $(pwd)`
fi
DIRNAME=`dirname ${BASH_SOURCE[0]}`
DIRNAME=`readlink -f ${DIRNAME}`
if [ "${DIRNAME}" == "." ]; then
DIRNAME=`pwd`
fi
INSTANCECOUNT=0
for i in ${DIRNAME}/print-instance-args_*.sh ; do
INSTANCE=`basename $i ` #Just the file
INSTANCE=${INSTANCE:20} #Remove the first 20 chars (print-instance-args_)
INSTANCE="_"${INSTANCE:0:-3} #Remove the last 3 chars (.sh)
if [ "${1}" == "main" ]; then
set -- "" "${@:2}"
fi
if [ "${INSTANCE:1}" == "main" ]; then
INSTANCE=""
fi
if [ "${INSTANCE:1}" == "*" ]; then
break;
else
INSTANCECOUNT=` expr ${INSTANCECOUNT} + 1 `
fi
if [ "${1}" == "${INSTANCE:1}" -o "${1}" == "" ]; then
if [ "${MATCHED}" == "1" ]; then
break
fi
if [ "${1}" == "${INSTANCE:1}" ]; then
MATCHED=1
fi
#Do this for each of them (or the match)
#echo Name: ${NAME}, DirName: ${DIRNAME}, Instance: ${INSTANCE:1}, Counter: ${INSTANCECOUNT}.
if [ ! -d /mnt/mounts/Docker/${NAME}${INSTANCE}/ ]; then
echo Check-Nothing > /dev/null
fi
fi
done
if [ "${INSTANCECOUNT}" == "0" ]; then
echo $0: No instances found, nothing was done. >&2
fi