Skip to content
This repository was archived by the owner on Dec 20, 2023. It is now read-only.

Commit e531edb

Browse files
committed
First commit after git repo creation
0 parents  commit e531edb

20 files changed

+2357
-0
lines changed

check

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
#!/bin/bash
2+
# Load common code
3+
source /root/scripts/psync/conf/config.sh
4+
# Load customer information
5+
source ../customer_info
6+
7+
extra=""
8+
while getopts ":l" opt; do
9+
case $opt in
10+
l)
11+
extra+="-l"
12+
lite="true"
13+
;;
14+
\?)
15+
;;
16+
esac
17+
done
18+
19+
send_mail=1
20+
lastcode=1
21+
logfile="$logdir/psync-$script.lastrun"
22+
mailcmd_notice="mail -r $FROM -s NOTICE:PSYNC:$CUSTOMER_NAME:$HOSTNAME $RCPT"
23+
mailcmd_alert="mail -r $FROM -s ALERT:PSYNC:$CUSTOMER_NAME:$HOSTNAME $RCPT"
24+
mailcmd_warning="mail -r $FROM -s WARNING:PSYNC:$CUSTOMER_NAME:$HOSTNAME $RCPT"
25+
options="$extra -r slave.assyoma.it /opt/fileserver /opt/fileserver"
26+
27+
# If a full check is running, exit
28+
if [ "$lite" == "true" ]; then
29+
running=`ps ax | grep "psync/check" | grep -v grep`
30+
running=`echo -n "$running" | wc -l`
31+
if [ $running -gt 1 ]; then
32+
exit
33+
fi
34+
fi
35+
36+
# Determine if we need to send and email
37+
if [ "$lite" == "true" ] && [ -e $logfile ]; then
38+
lastcode=`grep "EXIT CODE:" $logfile | grep -o "[[:digit:]]\+"`
39+
if [ -z "$lastcode" ]; then
40+
lastcode=1
41+
fi
42+
else
43+
lastcode=1
44+
fi
45+
46+
# Check
47+
date > $logfile
48+
output=`./rcheck.py $options`
49+
error=$?
50+
echo "EXIT CODE: $error" >> $logfile
51+
52+
# Error reporting
53+
if [ $error -gt 0 ] && [ $lastcode -gt 0 ]; then
54+
if [ $error -eq 1 ] || [ $error -eq 2 ]; then
55+
mailcmd=$mailcmd_warning
56+
elif [ $error -eq 3 ]; then
57+
mailcmd=$mailcmd_alert
58+
elif [ $error -eq 4 ]; then
59+
mailcmd=$mailcmd_notice
60+
fi
61+
mailobj="Scheduled comparision detected some unexpected differences\nPlease check them manually"
62+
mailobj="$mailobj\n$output"
63+
send_email
64+
fi

cinotify/cinotify

14.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)