[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

¡Esta es una revisión vieja del documento!


en traduccion

at - Programación de tareas

at es una herramienta de programación de tareas que permite al mismo tiempo realizar tareas en su sistema. El batch es como at pero realiza las tareas de una sola vez cuando la carga del sistema lo permite, todos los comandos y funciones de at pueden ser replicados por batch con los mismos argumentos.

Comandos relacionados

Se incluyen los siguientes comandos para monitorear el comando at :

  • at : el programa solía enviar una tarea única.
  • atq : el programa utilizado para revisar la cola de trabajos enviados con at

.

  • atrm : el programa utilizado para eliminar trabajos de la cola.

El uso del comando at

El comando at puede emitirse para permitirle escribir un script personalizado o señalarlo a un script preconstruido. Además, las amplias especificaciones de tiempo permitien aumentar la complejidad.

El argumento - m se puede agregar a cualquier comando que le indique al daemon que envíe un correo al usuario en el sistema local para avisarle de la finalización de la tarea.

Programación de un script existente

Este ejemplo le dirá a la aplicación at que ejecute el script /home/user/testscript.sh a las 4PM de hoy y envíe un correo electrónico al usuario al finalizar.

user@darkstar$ at 16:00 -m -f /home/user/testscript.sh

Como puede ver, el argumento - f significa archivo ya que apunta al archivo que se ejecutará.

Scheduling a New Action

As seen below, when no file is specified the at application opens a prompt for the user to enter the new script.

user@darkstar$ at 19:40 -m
warning: commands will be executed using /bin/sh
at> ping -c 4 www.google.com
at> echo $?
at> <EOT>
job 4 at Sun Dec 30 19:40:00 2012

The user will need to type the sequence of commands that will be issued within the prompt, upon completion you close the prompt with the Ctrl+d

The command above instructed at to ping google 4 times at 7:40PM, return the application status and e-mail the results to the user.

Be sure to note the job number, it is the only visible identifier for the job and must be referenced if you wish to remove the job later.

Reviewing Queued Tasks

The command atq lists the user's pending jobs. The output is Job Number, date, hour, queue and username.

user@darkstar$ atq
4 Sun Dec 30 19:40:00 2012 a user

Once the task number has been noted you can review the commands that are included in the job by issuing the command at -c {jobnumber}, and example is shown below.

user@darkstar$ at -c 4
#!/bin/sh
# atrun uid=1000 gid=1000
# mail user 1
umask 22
....Environment Details....
cd /home/user || {
   echo 'Execution directory inaccessible' >&2
   exit 1
}
ping -c 4 www.google.com
echo $?

Removing Queued Tasks

The command atrm removes jobs from the pending queue, it does not present any confirmation that the job is removed so it may be advisable to run atq after atrm to confirm the job has been removed.

user@darkstar$ atrm 4

Further Resources

Sources

* Originally written by mfillpot

 es:howtos:software:at ()