Linux/windows Execute Java program under the timer __linux

Source: Internet
Author: User
Tags schtasks

A. Windows Scheduled Tasks

Command description
-/SC Specifies the schedule type, with values for minute, hourly, daily, weekly, monthly, once, OnStart, Onlogon, OnIdle
-/mo Specifies how often a task is run within its schedule type
-/tn Specifies the name of the task
-/TR Specifies the program or command that the task runs. Type the fully qualified path and file name of the executable, script file, or batch file
* Create a task
-Boot Run task schtasks/create/sc onstart/tn "TaskName"/tr c:\test.bat
-Perform schtasks/create/sc minute/mo 10/tn "runpertenminuts"/tr every 10 minutes
* Terminate the Task
-Schtasks/end/tn "TaskName"
* Delete Task
-Schtasks/delete/tn "TaskName"
* View current system Scheduled Tasks list
-Schtasks


This example contains two files, one createtask.bat, one task.bat.

Createtask.bat is primarily a key to creating a Windows timed task, Task.bat is a batch file to run at timed intervals.

The Createtask.bat code is as follows:

[Java] view plain copy set base_dir=%~dp0%base_dir:~0,2% schtasks/create/tn mytask/sc once/st 00:03/tr %base_dir%task.bat

The Task.bat code is as follows:

[Java] view plain copy @echo off color 0a set base_dir=%~dp0%base_dir:~0,2% pushd%base_dir% JAVA-XM S512m-xmx512m-jar Test.jar popd Pause

Here Task.bat run the external program Test.jar, the reader to modify their own to run the file.

two. Linux Timing planning Tasks
Under Linux you need to create a new SH script, basically the same as under Windows




Pending completion ...




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.