Article Title: timed restart of tomcat in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
1. tomcat restart script
[Root @] # vi test. sh #! /Bin/sh export JAVA_HOME =/usr/java/j2sdk1.4.2 _ 06/pid = 'ps-auxww | grep tomcat | grep-v grep | awk' {print $2 }'' echo $ pid if [-n "$ pid"]; then {echo "=========== tomcat is start =============" '/usr/local/tomcat/bin/ shutdown. sh 'sleep 5'/usr/local/tomcat/bin/shutdown. sh 'sleep 15 pid = 'ps-auxww | grep tomcat | grep-v grep | awk' {print $2} ''if [-n" $ pid "]; then {echo "======= to kill the tomcat pid $ pid ========" kill $ pid sleep 3} fi echo "====== ===== start tomcat ============ "'/usr/local/tomcat/bin/startup. sh'} else {echo "========= tomcat is stop =====" '/usr/local/ tomcat/bin/startup. sh'} fi
2. Scheduled scripts: Execute the tomcat restart script at every day.
[Root @] # crontab-e 1 06 ***/home/mcc/test. sh
3. Start the scheduled service
[Root @] # service crond stop [root @] # service crond start
4. Check whether the task is in the timing list:
[Root @] # crontab-l 1 06 ***/home/mcc/test. sh