分类: LINUX
2014-08-04 11:09:18
Synchronization20140616.xml为导出来的xml流水文件。
[root@tam TDI]# cat startTdi.sh
#!/bin/sh
/opt/IBM/TDI/V7.1.1/ibmdisrv -c "/root/TDI/Synchronization20140616.xml" -r Synchronization -l "/root/TDI/sync.log" >/dev/null 2>&1 &
checkTdiServer.sh会监控ibmdisrv进程是否存在,如果不存在先killall掉其子进程,再重启ibmdisrv进程。如果ibmdisrv进程存在,则输出存在信息而不执行其他操作。
[root@tam TDI]# cat checkTdiServer.sh
#=========================================================================
# Purpose:when the server is not running,start it automatic
# Author :123
# History:2014-06-16
# Note :start TDI when it is down.
# run the script when start OS background
#=========================================================================
#!/bin/sh
while true
do
ps -ef | grep -v grep | grep ibmdisrv >> /dev/null
if [ $? -ne "0" ]; then
echo "the TDI server is not running, now start the server follow"
killall ibmdisrv
exec ./startTdi.sh
else
echo "the server is still running, we will exit"
exit 1
fi
sleep 2
done
执行命令:表示每5分钟监控一次,如果发现ibmdisrv存在则不执行任何操作,如果发现ibmdisrv不存在,则重启ibmdisrv进程;
#crontab –e
*/5 * * * * /root/TDI/checkTdiServer.sh