Linux timed Task access page instead of quartz cluster

Source: Internet
Author: User

Business background:Often there is a business in the web that needs to be timed out, but in a clustered environment, if timed tasks are turned on in multiple servers at the same time, the database hangs up, and only one scheduled task should actually access the database. How to solve this problem: 1, multi-server cluster, directory mount. Only one server holds a scheduled task, and when mounted, excludes the profile of the scheduled task, allowing only one server to start the scheduled task. 2, the deployment of a single server, used to run the scheduled Task 3, the use of Linux scripts, access to the Cluster Server page or action, there must be a server received the request, and then perform the timing. Here is the 3rd way, the disadvantage is: the server is accessed by the page or action need to do security restrictions.
First, configure the Linux timer task: Vi/etc/crondtab
0 1 * * *Root/dbdata/Backup/CMS/Async.SH
Then, in async.sh, send an email alert if the request goes wrong:
#!/bin/bashDir="/home/webtrn/CrontabDir"echo `date +"%Y-%m-%d-%H-%M"` >> $Dir/checklearntime.logwget-T1 http://www.baidu.com /Checkserver/XXX.JSP-o $Dir/Wgetchecklearntime.Loggrep-Q"404"$Dir/Wgetchecklearntime.Log||grep-Q"302"$Dir/Wgetchecklearntime.Logif    [  $     !=    0  Span class= "PLN" style= "Color:rgb (72,72,76)" " ";   then   echo "checklearntime have done" >> $Dir/checklearntime.logelse echo  " Checklearntime is err or "    >>,   $Dir  / checklearntime   log   echo  " Checklearntime is err or "    |  Mail  - s   "WEBTRN"   [email protected]   com   echo "checklearntime is error" | mail -s "webtrn" [email protected].comfirm -f XXX.jsprm -f $Dir/wgetchecklearntime.log

Linux timed Task access page instead of quartz cluster

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.