Skip to content

Commit fa47509

Browse files
committed
remove old app files
1 parent 21b6f2f commit fa47509

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/usr/bin/env bash
2+
# remove old app files, not restrict, NO QA
3+
set -o errexit
4+
apps_dir="/opt/ebt/apps"
5+
current_pwd=$(pwd)
6+
if [[ ${current_pwd} != ${apps_dir} ]]; then
7+
cd apps_dir
8+
fi
9+
app_list="
10+
appname1
11+
appname2
12+
appname3
13+
"
14+
15+
current_app_list=$(ls -1 .)
16+
17+
for app in ${app_list};do
18+
if [[ ${current_app_list} =~ ${app} ]]; then # if echo "${strings}" | grep ${string}; then
19+
app_count=$(ls -t . | grep ${app}| wc -l)
20+
if [[ ${app_count} > 2 ]]; then
21+
app_count=$(expr ${app_count} - 2 ) # app_count=$((app_count-2))
22+
fi
23+
echo "Found:$app, Old files count:$app_count"
24+
ls -t . | grep ${app} | tail -${app_count} | xargs rm -rf
25+
fi
26+
done

0 commit comments

Comments
 (0)