Timed restart of tomcat in Linux

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.