Linux writes a scheduled task Shell Daemon

Source: Internet
Author: User
# Set the dump file size limit. Ulimit-C unlimitedcd/home/linbc/build/bin # Check whether the dump Folder does not exist.  If [! -D ../dumpfile] Then ECHO "Create dumpfile fold" Mkdir ../dumpfilefi # Search

   
 
  
    
My

   
 _ App1: whether it exists (we cannot restart this process every time. For example, in my scenario, I will continue to start the app1 process if it exists)  If [-Z 'pgrep
 
  
  
  
    My 
   
 
 _ App1'] Then ECHO "My_app1 not running! " Exitfi # Check whether my_app2 exists. If it does not exist, start  If [-Z 'pgrep my_app2'] Then ECHO "My_app2 not running! "         # Back up the dump file. I have created a folder in this path to store the dump file. App2_pid = 'Tail-1 ../dumpfile/app2.pid' If [-N $ app2_pid-a-e "Core. $ {app2_pid }" ] Then ECHO "Backup dumpfile, move core. $ {app2_pid} ../dumpfile/centd. Core. $ {app2_pid }" MV "Core. $ {app2_pid }"   "../Dumpfile/app2.core. $ {app2_pid }" FI echo "Start the app2 server" Nohup./my_app2-C my_app2.conf> _ app2.out 2> & 1 & # Save the process number to rename the dump file Pgrep my_app2> ../dumpfile/app2.pidficd $ {oldpwd}

 
 
 

Then you can

Crontab-e

Write

0-59/5 ****/home/linbc/bin/check_the_process

Check every five minutes

Related Article

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.