\subsection{\BtjdelName}

\begin{expara}

\BtjdelName{} [ -options ] job number ...

\end{expara}

\PrBtjdel{} provides a means of deleting batch jobs from the shell or a program, optionally killing running jobs if
required.

Jobs are specified by using the job number, as displayed by \PrBtr{} with the \exampletext{{}-v}
(verbose) option, or as in the output of the first column of the \PrBtjlist{} command with default format.

Remote jobs should be specified by prefixing the job numbers with the host name thus:

\begin{expara}

host:1234

\end{expara}

It is not necessary to specify any leading zeroes.

Appropriate error messages are displayed if the user attempts to delete a job which is either running or if the user does not have the
necessary permissions.

\subsubsection{Options}
The environment variable on which options are supplied is \filename{\BtjdelVarname} and the environment variable to specify the
help file is \filename{BTRESTCONF}.

\setbkmkprefix{btjdel}
\explainopt

\cmdoption{C}{command-prefix}{name}{cprefix}

Specify the given name as the prefix for the command file, followed by the job number, to be used by the
\exampletext{{}-u} option rather than the default of \exampletext{C} (which in turn may be changed by editing the
message file).

\cmdoption{D}{directory}{name}{directory}

Save unqueued jobs to name rather than the current directory when \PrBtjdel{} is invoked.

\cmdoption{d}{delete}{}{delete}

Cancel any previous \exampletext{{}-k} option to be the default of deleting jobs.

\cmdoption{e}{do-not-unqueue}{}{nounqueue}

Cancel the effect of a previous \exampletext{{}-u} or \exampletext{{}-X} option.

\cmdoption{J}{job-prefix}{name}{jprefix}

Specify the given \genericargs{name} as the prefix for the job file, followed by the job number, to be used by the
\exampletext{{}-u} option rather than the default of \exampletext{J} (which in turn may be changed by editing the
message file).

\cmdoption{K}{signal-number}{signal}{signal}

Apply \genericargs{signal} given to kill running job. Default is 15 (\filename{SIGTERM}).

\cmdoption{k}{do-not-delete}{}{nodelete}

Kill jobs only where applicable, do not delete.

\cmdoption{N}{no-force}{}{noforce}

Do not kill or delete running jobs (default).

\cmdoption{S}{sleep-time}{seconds}{sleeptime}

Monitor process state for \genericargs{seconds} seconds after killing (default 10 seconds).

\cmdoption{u}{unqueue}{}{unqueue}

Unqueue job(s) to the current directory (or as specified by the \exampletext{{}-D} option). Do not delete if \exampletext{{}-k} given.

\cmdoption{X}{xml-unqueue}{}{xmlunqueue}

As with \exampletext{{}-u}, but unqueue to just a job file in XML format. Note that the suffix \batchjobsuffix{} will be appended if not specified.

\cmdoption{Y}{force}{}{force}

Kill and delete running jobs.

\freezeopts{\filename{\BtjdelVarname}}{Stop}

\subsubsection{Examples}
To delete jobs even if running:

\begin{expara}

\BtjdelName{} -y 1237 avon:9371

\end{expara}

Kill a job without deleting it with signal 2
(\filename{SIGINT}).

\begin{expara}

\BtjdelName{} -K 2 -k 9120

\end{expara}

Take a copy of the job in a work directory without deleting it.

\begin{expara}

\BtjdelName{} -u -k -D \~{}/work -C spec -J script 9123

\end{expara}

