Keep only the next 'at'-job and delete all future jobs in A72_alarm_getter.sh
Modified delete_expired_at_jobs function to retain only the next 'at'-job and delete all upcoming jobs. This ensures that only the immediate 'at'-job remains scheduled.
This commit is contained in:
parent
76d38622c6
commit
c5d7167bb1
@ -25,6 +25,15 @@ delete_expired_at_jobs() {
|
||||
else
|
||||
echo "Keine überholten 'at'-Jobs gefunden."
|
||||
fi
|
||||
|
||||
# Behalte nur den nächsten 'at'-Job und lösche alle zukünftigen Jobs
|
||||
next_job_id=$(/usr/bin/atq | awk '{print $1}' | sort -n | head -n 1)
|
||||
if [ -n "$next_job_id" ]; then
|
||||
/usr/bin/atrm $(/usr/bin/atq | awk -v next_job_id="$next_job_id" '$1 > next_job_id {print $1}')
|
||||
echo "Nur der nächste 'at'-Job bleibt erhalten: $next_job_id"
|
||||
else
|
||||
echo "Keine 'at'-Jobs gefunden."
|
||||
fi
|
||||
}
|
||||
|
||||
# Verwende die Funktion, um überholte Jobs zu löschen
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user