at, batch, wts

execute commands at a later time 

Command


SYNOPSIS

at [-m] [[-c|-k|-s]|-C command] [-f file] [-q queuename] -t [[cc]yy]mmddhhmm[.ss]

at [-m] [[-c|-k|-s]|-C command] [-f file] [-q queuename] timespec...

at -r taskname ...

at -l [-q queuename] [taskname ...]

batch

wts [-S hostname] [-am] [-n taskname] [[-c|-k|-s]|-C command] [-f file] -t [[cc]yy]mmddhhmm[.ss]

wts [-S hostname] [-am] [-n taskname] [[-c|-k|-s]|-C command] [-f file] timespec...

wts [-S hostname] -z taskname...

wts [-S hostname] -r taskname...

wts [-S hostname] -e taskname...

wts [-S hostname] -l [-v] [taskname...]


DESCRIPTION

The at utility lets you set up one or more tasks to be executed at a later time. at reads the tasks (as command lines) from the standard input or from a file specified with the -f option.

The batch utility is the equivalent of:

at -q b -m now

The wts utility is similar to at in that it creates a task to be run at a later time. Based on the capabilities of the Windows Task Scheduler, wts lets you run tasks on a remote systems, start tasks immediately, remove tasks, specify unique task names, and edit scheduled tasks.

When you add a task, at, batch, or wts displays a task name on standard output along with the time that the task is to be executed. Task names are of the form:

MKS_AT_user_queuename_currentdatetime	(for at and batch tasks)
MKS_WTS_user_currentdatetime		(for wts tasks)

where user is the local user name or the domain user name with a + in place of the \ and queuename is the queue name specified in the command line. If no queuename is specified, at tasks are placed in queue a and batch tasks are placed in queue b.

Note:

Once a task name has been assigned to a task, you should not rename that task. Renaming tasks could cause possible problems with some utilities in the MKS Toolkit Scheduling Suite.

Additionally, on 8.1/2012R2/10/2016/2019/11/2022 the mksauth authentication service is queried to get the current user's password (unless the -a is specified). The newly added task will be run using the current user name, the retrieved password, and the normal start-up environment for the user. If a password cannot be retrieved, the task is added with no user name and password. You must be in the administrator group to add tasks without having a password saved with the mksauth authentication service. Such tasks are run using the environment as it exists at the time of their execution.

On 8.1/2012R2/10/2016/2019/11/2022, use passwd or rsetup to set your password for the mksauth service.

Common practice is to redirect the standard output and standard error from tasks to files so you can read the output after the tasks have completed. If you do not redirect the standard output or standard error, at, batch, and wts e-mail these streams to you using smtpmail or write the streams to a log file depending on how the SCHEDULER_MAILTO and SCHEDULER_LOGFILE environment variables are set.

When SCHEDULER_MAILTO is set, its value is the e-mail address to which the standard output and standard error stream are sent using smtpmail.

Note:

You must have smtpmail properly set up on your system.

When SCHEDULER_LOGFILE is set, its value is the name of the log file to which the standard output and standard error streams are appended.

When both environment variables are set, the streams are both e-mailed and written to the log file. When neither environment variable is set, the streams are appended to the default log file $ROOTDIR/etc/scheduler/log/user, where user is the name of the user who scheduled the job. When user is a domain name, the \ in the name is replaced with a +.

When a task does not produce any output or errors, you are not normally informed of its completion. You can use the -m to be informed of a task's completion even when no output or errors are produced.

Normally, tasks submitted with the at, batch, and wts utilities are run by the taskrun utility. The taskrun utility captures the output and errors produced by the task. It is actually the taskrun command that is run by the Windows Task Scheduler.

Note:

If for some reason, Windows Task Scheduler does not complete a task, no output from the task is available. Reasons could include the Windows Task Scheduler service being turned off or your task taking longer than three days to complete.

When you add a task, you must specify the date and time at which is to be run with either the -t option or with timespec as described in Time Specifications. If the time specified for a task to run is in the past, the task is run immediately.

All tasks added with these commands have the TASK_FLAG_HIDDEN flag set. This causes the task to be hidden and to run in a hidden window. Because these tasks are hidden, they do not show up when you select Scheduled Tasks from the Control Panel.

Options

Unless otherwise specified, you can use the following options with either at or wts:

-a 

runs the specified task using the SYSTEM account instead of the current user's account. For this option to work correctly, you must be a member of the administrator group.

This option is only available with the wts utility.

-C command 

the specified command is run directly without using taskrun. No output from command is available (unless you redirect it).

This option is provided primarily for running tasks on remote systems which do not have a version of MKS Toolkit with taskrun installed.

-c 

runs the task using the MKS C Shell (csh). If command is the task's command line, taskrun runs it as:

csh command
-e taskname 

launches the Windows Task Scheduler properties pages for the specified taskname. This allows you to edit the task, including properties that cannot currently be set with the wts utility.

This option is only available with the wts utility.

-f file 

reads tasks (as command lines) from the specified file rather than standard input.

-k 

runs the task using the MKS KornShell in Korn-compatible mode (ksh). If command is the task's command line, taskrun runs it as:

ksh command
-l 

displays the task name and next scheduled run time for all tasks that you have permission to access. If you specify a taskname, only information on that task is displayed.

-m 

informs you of the task's completion even if the task produced no output or errors. Information on the task's completion is e-mailed and/or written to a log file based on SCHEDULER_MAILTO and SCHEDULER_LOGFILE as described earlier.

-n taskname 

specifies a name for the task. This name is used instead of the default name normally assigned by wts.

This option is only available with the wts utility.

-q queuename 

specifies the queue in which to place the task. Queue names can be any lowercase letter (a, b, ... z). When specified with the -l option, only tasks in the specified queue are listed.

This option is only available with the at utility.

-r taskname 

removes previously scheduled taskname.

-S hostname 

schedule task to run (or manipulate previously scheduled tasks) on the remote system named hostname. To run a task on a remote system, you must be a member of the administrator group on that system.

This option is only available with the wts utility.

-s 

runs the task using the MKS KornShell in its default POSIX mode (sh). If command is the task's command line taskrun runs it as:

sh command
-t [[cc]yy]mmddhhmm[.ss

specifies the date and time at which the task is to be run.

-v 

displays additional information about tasks listed with the -l option.

This option is only available with the wts utility.

-z taskname 

runs the specified taskname immediately. This task is not removed and will still run at its scheduled times.

This option is only available with the wts utility.

Time Specifications

When you do not you use the -t option with at or wts, you can use a timespec argument to specify the time with considerable amount of freedom. A timespec argument consists of three parts: a time, a date, and an increment (in that order). You must always specify the time but you may omit the date and/or the increment. Here are the possible time formats:

hhmm		hh hours, mm minutes, 24-hour clock
hh:mm		hh hours, mm minutes, 24-hour clock
h:mm		h hours, mm minutes, 24-hour clock
h:m		h hours, m minutes, 24-hour clock
hh:mm zone	zone is time zone
hh:mm am		morning, twelve hour clock
hh:mm am zone	morning, twelve hour clock in given zone
hh:mm pm		afternoon, twelve hour clock
hh:mm pm zone	afternoon, twelve hour clock in given zone
noon		noon
midnight		midnight
next		current time, next day that meets date and increment;
		or equivalent of +1 modifier
now		current time today

Note:

In these formats, all minute specifications are optional. For example, to specify an at task to run at 1:00 pm, you can simply enter:

at 1pm

Here are the possible date formats:

month day		month is full name, or 3-letter abbreviation,
		as in January or Jan
month day, year	day and year given as appropriate numbers
weekday		weekday is full name, or 3-letter abbreviation,
		as in Monday or Mon
today		current day
tomorrow		next day

The increment is added to the time and date that you specify with the preceding parts of timespec. It has the format

+ n units

where n is a number and units is one of:

minute     minutes    hour     hours
day        days       week     weeks
month      months     year     years

The keyword next can be used instead of + 1. Here are some sample time specifications:

0655
1855
18:55
6:55pm
6:55 pm Jan 10
now + 3 hours
next week
noon tomorrow
midnight Friday

ENVIRONMENT VARIABLES

SCHEDULER_MAILTO 

specifies the e-mail address to which smtpmail sends all mail generated by these utilities.

SCHEDULER_LOGFILE 

specifies the log file to which information normally mailed is appended.

TK_UNIX_FILESYSTEM 

When this variable is set, the Enhanced UNIX Compatibility Mode is on and the virtual file system is in use.

When the Enhanced UNIX Compatibility Mode is on, all path names in the commands that you schedule should be Windows path names. In addition, information about a scheduled job (such as the working directory) is displayed using Windows path names.

For details on the Enhanced UNIX Compatibility Mode and the virtual file system, see the EUCM reference page.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

>0 

An error occurred.


PORTABILITY

Windows 8.1. Windows Server 2012 R2. Windows 10. Windows Server 2016. Windows Server 2019. Windows 11. Windows Server 2022.


AVAILABILITY

PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Commands:
crontab, mksauth, passwd, rsetup, smtpmail, taskrun

MKS Toolkit Scheduling Solutions Guide


PTC MKS Toolkit 10.4 Documentation Build 39.