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 ...