Simple script + Scheduled task

Source: Internet
Author: User

First, because the report server does not know what causes the service is always abnormal, service inexplicably stopped, development said may be due to code anomalies, so write a simple script and scheduled tasks, every two minutes to review the process, if not start the process, otherwise do nothing.

The script is as follows:

#!/bin/bash. /etc/profilea= ' Ps-ef | grep Tomcat-report | Grep-v grep | Wc-l ' anti-quote if ["$a"-ne 1]THEN/USR/LOCAL/TOMCAT-REPORT/BIN/STARTUP.SHFI

The scheduled tasks are as follows:

# CRONTAB-L*/2 * * * */bin/bash/usr/local/tomcat-report/bash/re.sh


Second, MySQL to remote backup, the monthly 15th 0:0 back up the library, named with a timestamp and compression.

The script is as follows:

#!/bin/bash. /etc/profilea= ' Date +%y%m%d ' mysqldump-u root-h 10.10.222.8 Cloud | gzip-9 >/data/cloud/cloud-$A. sql.gzmysqldump-u root-h 10.10.222.9 Istorm | gzip-9 >/data/istorm/istorm-$A. sql.gz

The password is written in the/ETC/MY.CNF (the machine performing the backup)

[mysqldump]user=rootpassword=123456

The scheduled tasks are as follows:

# crontab-l0 0 * */bin/bash/data/mysql.sh



This article is from the "Promise" blog, make sure to keep this source http://hatech.blog.51cto.com/8360868/1694118

Simple script + Scheduled task

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.