-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcleanup-zos.sh
executable file
·138 lines (126 loc) · 4.12 KB
/
cleanup-zos.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
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/bin/sh
################################################################################
# This program and the accompanying materials are
# made available under the terms of the Eclipse Public License v2.0 which accompanies
# this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html
#
# SPDX-License-Identifier: EPL-2.0
#
# Copyright Contributors to the Zowe Project.
################################################################################
################################################################################
# constants
SCRIPT_NAME=$(basename "$0")
SCRIPT_PWD=$(cd $(dirname "$0") && pwd)
################################################################################
echo "[${SCRIPT_NAME}] df"
df -k
echo
################################################################################
echo "[${SCRIPT_NAME}] deleting /ZOWE/tmp/zowe-packaging*"
cd /ZOWE/tmp
for i in $(find . -type d -ctime +1 -name 'zowe-packaging*'); do
if [ -n "$i" ]; then
echo "[${SCRIPT_NAME}] - /ZOWE/tmp/${i}"
echo "rm -fr ${i}" | su
fi
done
for i in $(find . -type f -ctime +1 -name 'zowe-packaging*'); do
if [ -n "$i" ]; then
echo "[${SCRIPT_NAME}] - /ZOWE/tmp/${i}"
echo "rm -fr ${i}" | su
fi
done
for i in $(find . -type d -ctime +1 -name 'pax-packaging*'); do
if [ -n "$i" ]; then
echo "[${SCRIPT_NAME}] - /ZOWE/tmp/${i}"
echo "rm -fr ${i}" | su
fi
done
for i in $(find . -type f -ctime +1 -name 'pax-packaging*'); do
if [ -n "$i" ]; then
echo "[${SCRIPT_NAME}] - /ZOWE/tmp/${i}"
echo "rm -fr ${i}" | su
fi
done
# SMPE cannot handle lower case directory
cd /ZOWE/TMP
for i in $(find . -type d -ctime +1 -name 'ZOWE-PACKAGING*'); do
if [ -n "$i" ]; then
echo "[${SCRIPT_NAME}] - /ZOWE/TMP/${i}"
echo "rm -fr ${i}" | su
fi
done
echo
################################################################################
echo "[${SCRIPT_NAME}] deleting /ZOWE/tmp/~jenkins*"
cd /ZOWE/tmp
for i in $(find . -type d -ctime +1 -name '~jenkins*'); do
if [ -n "$i" ]; then
echo "[${SCRIPT_NAME}] - /ZOWE/tmp/${i}"
echo "rm -fr ${i}" | su
fi
done
echo
################################################################################
echo "[${SCRIPT_NAME}] deleting ~/zowe/logs"
if [ -d ~/zowe/logs ]; then
cd ~/zowe/logs
for i in $(find . -type f -ctime +1); do
if [ -n "$i" ]; then
echo "[${SCRIPT_NAME}] - ~/zowe/logs/${i}"
echo "rm -fr ${i}" | su
fi
done
fi
echo
################################################################################
echo "[${SCRIPT_NAME}] deleting /tmp/tomcat*"
cd /tmp
echo "rm -fr tomcat.*" | su
echo "rm -fr tomcat-docbase.*" | su
echo
################################################################################
echo "[${SCRIPT_NAME}] deleting /tmp/zowe-*.env"
cd /tmp
for i in $(find . -type f -ctime +1 -name 'zowe-*.env'); do
if [ -n "$i" ]; then
echo "[${SCRIPT_NAME}] - /tmp/${i}"
echo "rm -fr ${i}" | su
fi
done
echo
################################################################################
echo "[${SCRIPT_NAME}] deleting /tmp/*.jcl"
cd /tmp
for i in $(find . -type f -ctime +1 -name '*.jcl'); do
if [ -n "$i" ]; then
echo "[${SCRIPT_NAME}] - /tmp/${i}"
echo "rm -fr ${i}" | su
fi
done
echo
################################################################################
opercmd=/ZOWE/zowe-installs/opercmd.rexx
if [ -f "${opercmd}" ]; then
echo "[${SCRIPT_NAME}] purge job queue and output"
echo "[${SCRIPT_NAME}] - \$P JQ,DAYS>2,PROT"
"${opercmd}" '$P JQ,DAYS>2,PROT'
echo "[${SCRIPT_NAME}] - \$PO STC1-9999"
"${opercmd}" '$PO STC1-9999'
echo "[${SCRIPT_NAME}] - \$PO TSU1-9999"
"${opercmd}" '$PO TSU1-9999'
echo "[${SCRIPT_NAME}] - \$PO JOB1-9999"
"${opercmd}" '$PO JOB1-9999'
echo
fi
################################################################################
compressRexx=/tmp/compress.rexx
if [ -f "${compressRexx}" ]; then
echo "[${SCRIPT_NAME}] compress datasets"
"${compressRexx}" VENDOR.PROCLIB </dev/null
"${compressRexx}" VENDOR.PARMLIB </dev/null
fi
################################################################################
echo "[${SCRIPT_NAME}] done."
exit 0