-
Notifications
You must be signed in to change notification settings - Fork 0
/
purge_fs_cron.sh
46 lines (36 loc) · 1.14 KB
/
purge_fs_cron.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
#!/bin/bash
# Fred Denis -- [email protected] -- June 18th 2015
# Launch the purge script from cron
#
DIR=`dirname $0`
PURGE_SCRIPT=${DIR}/purge_fs.sh
LOG=${DIR}/log/purge_fs`date +%Y%m%d%H%M`.log
if [ ! -d ${DIR}/log ]
then
mkdir -p ${DIR}/log
fi
if [ ! -f ${PURGE_SCRIPT} ]
then
echo "Error " ${PURGE_SCRIPT} " is not there !" | tee -a $LOG
exit 345
fi
cat << ! | tee -a $LOG
S T A R T P U R G E
!
date | tee -a $LOG
. ${PURGE_SCRIPT} | tee -a $LOG
date | tee -a $LOG
. ${PURGE_SCRIPT} -p | tee -a $LOG
date | tee -a $LOG
. ${PURGE_SCRIPT} | tee -a $LOG
date | tee -a $LOG
cat << ! | tee -a $LOG
E N D P U R G E
!
grep -i error $LOG > /dev/null 2>&1
if [ $? -eq "0" ]
then # Something went wrong
echo "Something went wrong, please check the logs"
else # All went fine
echo "All went fine !"
fi