-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathclean.sh
More file actions
executable file
·76 lines (64 loc) · 2.08 KB
/
clean.sh
File metadata and controls
executable file
·76 lines (64 loc) · 2.08 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
64
65
66
67
68
69
70
71
72
73
74
75
76
#!/bin/bash
#get working directory
HOME=`pwd`
BUILD_DIR="$HOME/build"
MISSION_DIR="$HOME/moos-ivp-UNDERSEA/missions/uuvExemplar"
VERBOSE=""
KILLALL="no"
REMOVE="no"
function killAll {
# processesShoreside=("pAntler" "MOOSDB" "uProcessWatch" "uTimerScript" "pHostInfo" "pShare" "uFldShoreBroker" "uFldNodeComms" pMarineViewer)
processesVehicle=(MOOSDB uProcessWatch uSimMarine pNodeReporter pMarinePID pHelmIvP sSensor sUUV pMarineViewer pAntler uTimerScript)
#printf "Shoreside:\t"
for i in ${processesShoreside[@]}; do
printf "%s\t" ${i}
kill -9 $(ps aux | grep ${i} | awk '{print $2}')
done
#printf "\nVehicle:\ts"
for i in ${processesVehicle[@]}; do
#printf "%s\t" ${i}
kill -9 $(ps aux | grep ${i} | awk '{print $2}') >& /dev/null &
done
echo
}
#-------------------------------------------------------
# Part 1: Check for and handle command-line arguments
#-------------------------------------------------------
for ARGI; do
if [ "${ARGI}" = "--help" -o "${ARGI}" = "-h" ] ; then
printf "%s [SWITCHES] \n" $0
printf " --verbose \n"
printf " --help, -h \n"
exit 0;
elif [ "${ARGI}" = "kill" -o "${ARGI}" = "-k" ] ; then
KILLALL="yes"
elif [ "${ARGI}" = "remove" -o "${ARGI}" = "-r" ] ; then
REMOVE="yes"
elif [ "${ARGI}" = "--verbose" -o "${ARGI}" = "-v" ] ; then
VERBOSE="-v"
else
printf "Bad Argument: %s \n" $ARGI
exit 0
fi
done
#-------------------------------------------------------
# Part 2: Do the cleaning!
#-------------------------------------------------------
if [ ${KILLALL} = "yes" ]; then
printf "Shutting down MOOS-IvP!\n"
#kill -9 $(ps aux | grep "pAntler" | awk '{print $2}') >& /dev/null &
killAll
fi
if [ ${REMOVE} = "yes" ]; then
printf "Cleaning mission files in $BUILD_DIR\n"
#cd moos-ivp/missions/uuvExemplar
cd $MISSION_DIR
rm -f .LastOpenedMOOSLogDirectory
rm -rf $VERBOSE MOOSLog_* LOG_*
rm -rf $VERBOSE *~ targ_* *.moos++ log *SENSOR*.moos *UUV*.moos
rm -f logfile/*
cd $HOME
if [ "$(ls -A $BUILD_DIR/)" ]; then
rm -r $BUILD_DIR/*
fi
fi