Introduzione:
Il comando atq mi dà l'elenco dei lavori in attesa di essere eseguiti e i loro tempi di esecuzione. Ogni riga che inizia con il numero del lavoro.
Il comando at -c JobNumber mi dà il contenuto del lavoro comprese le variabili di ambiente.
Quello che volevo è un comando che mi desse l'elenco dei lavori (proprio come il comando atq ) ma ampliato in modo che ogni riga di lavoro sia seguita dai comandi che verranno eseguiti, esclusi loro variabili d'ambiente. es.34 Tue Jan 17 10:22:00 2017 a root
Commands
35 Tue Jan 24 17:50:00 2017 a root
Commands
28 Tue Dec 13 23:00:00 2016 a root
Commands
24 Mon Nov 14 20:27:00 2016 a root
Commands
31 Sun Jan 15 00:21:00 2017 a root
Commands
Humm... non sono riuscito a trovare tale comando per visualizzare questo. Quindi ho creato questo script bash che fa il lavoro:
#!/bin/bash
# Description: Displays all 'at' jobs and their respective commands
# Syntax: atlist.sh
# Changes: 05.11.2016 First implementation
########################################################################
# Get the short jobs list and expand from there
atq | while read line ; do
jobnr=$(echo $line | awk '{print $1}')
echo $line
# Pickup all the command lines after first line matching '}'.
# This excludes all the environment variables and the at exit line.
# Exclude the matching '}' line and empty lines
# Add an offset of 8 chars to each command line.
at -c $jobnr | sed -e '1,/^\}/d' -e '/^$/d' -e 's/^/ /'
done