logrotate -d /etc/logrotate.d/apache2.conf(to log rotate manually)
OR
cd /etc/logrotate.d
logrotate –force kannelnum (Manual Logrotate)
cat /etc/logrotate.d/kannel801
——————————-
/var/log/kannel/kannellog/access45.log {hourly
missingok
rotate 7
compress
delaycompress
#notifempty
create 640 root root
sharedscripts
postrotate
#/home/kannel/kannel801/init.d/kannel801 restart > /dev/null 2>/dev/null || true
#killall -HUP bearerbox smsbox wapbox || true > /dev/null 2> /dev/null
sh /opt/kannel_rotate/kan45.sh >> /opt/kannel_rotate_log/kan45.log 2>&1
endscript
}
cat /opt/kannel_rotate/kan801.sh
#!/bin/bash
port=801
/home/kannel/Gkannel/kannel$port/init.d/kannel$port stop
sleep 2
/home/kannel/Gkannel/kannel$port/init.d/kannel$port start
sleep 2
/home/kannel/Gkannel/kannel$port/init.d/kannel$port status | grep ‘stop’ > /opt/kannel_log/kan$port.log
i=0
b=$(cat /opt/kannel_log/kan$port.log | wc -l)
while [ $b -ge 1 ]
do
c=$((i++))
echo $c
/home/kannel/Gkannel/kannel$port/init.d/kannel$port stop
sleep 2
/home/kannel/Gkannel/kannel$port/init.d/kannel$port start
sleep 2
/home/kannel/Gkannel/kannel$port/init.d/kannel$port status | grep ‘stop’ > /opt/kannel_log/kan$port.log
b=$(cat /opt/kannel_log/kan$port.log | wc -l)
#break [2]
if [ $c -eq 1 ]
then
echo “Kannel $port DOWN” | mailx -v -s “Kannel $port DOWN” webnoid@domain.com
echo “Bye”; break;
else
echo “not match”
fi
done
cat /opt/kannel_rotate_log/kan45.log 2>&1
——————————————–
touch: cannot touch ‘/var/lock/subsys/kannel/kannel801’: No such file or directory
Shutting down sbox801 (kannel):
Shutting down bbox801 (kannel):
Starting bbox801 service (gateway kannel):
Starting sbox801 service (gateway kannel):
Shutting down sbox801 (kannel):
Shutting down bbox801 (kannel):
Starting bbox801 service (gateway kannel):
Starting sbox801 service (gateway kannel):
cat /opt/kannel_log/kan$port.log
port down details