-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathehcpdaemon2.sh
executable file
·51 lines (40 loc) · 1.05 KB
/
ehcpdaemon2.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
#!/bin/bash
# This small shell is written to re-run php based daemon in case of failure..
# because php based daemon quits sometime ocasionally or un-expectedly...
echo "running ehcp daemon in shell background..."
function check_program(){
php -l $1
if [ $? -ne 0 ] ; then
echo "ehcp -> programda hata var: $1" | sendmail "[email protected]"
fi
}
hatasayisi=0
function check_programs(){
for i in *.php config/*.php language/*.php
do
php -l $i
if [ $? -ne 0 ] ; then
echo "Error - Hata : $i "
echo "ehcp -> programda hata var: $i " > email
php -l $i 2>&1 >> email
cat email | sendmail "[email protected]"
let hatasayisi=hatasayisi+1
if [ $hatasayisi > 5 ] ; then
echo "Too many errors, check your system or re-download ehcp. You may have problem in php configuration/installation"
exit
fi
fi
sayi=`grep "<?php" $i | wc -l`
if [ $sayi -eq 0 ] ; then
echo "Dikkat! php dosyasinda <?php tagi yok."
#exit
fi
done
}
while true
do
cd /var/www/new/ehcp
check_programs
php index.php daemon
sleep 20
done