RUVIDEO
Поделитесь видео 🙏

Schedule Future Tasks in Linux Using at Command and Crontab

📁 Обучение 👁️ 18 📅 03.12.2023

Schedule Non repetative tasks with at command:

Commands used with at:
at : execute commands at specified time.
atq : lists the pending jobs of users.
atrm : delete jobs by their job number.
1. Schedule first job using at command
Below example will schedule “sh backup.sh” command to be executed on next 9:00 AM once.

at 9:00 AM
at sh backup.sh
at ^d
job 3 at 2013-03-23 09:00
Use ^d to exit from at prompt.
You can also use the following option to schedule a job. The below command will run “sh backup.sh” at 9:00 in the morning.

echo "sh backup.sh" | at 9:00 AM
2. List the scheduled jobs using atq
When we list jobs by root account using atq, it shows all users jobs in the result. But if we execute it from a non-root account, it will show only that users jobs.

atq

3 2013-03-23 09:00 a root
5 2013-03-23 10:00 a rahul
1 2013-03-23 12:00 a root
Fields description:
First filed: job id
Second filed: Job execution date
third filed: Job execution time
Last field: User name, under which job is scheduled.

3. Remove scheduled job using atrm
You can remove any at job using atrm with their job id.

atrm 3
atq

5 2013-03-23 10:00 a rahul
1 2013-03-23 12:00 a root


4. Check the content of scheduled at job
atq command only shows the list of jobs but if you want to check what script/commands are scheduled with that task, below example will help you.

at -c 5
In the above example, 5 is the job id.

For more information please visit: (reference)
https://tecadmin.net/one-time-task-scheduling-using-at-commad-in-linux/

============================================================
Schedule repetative tasks with Crontab:

# crontab -e
SHELL=/bin/bash
[email protected]
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

# backup using the rsbu program to the internal 4TB HDD and then 4TB external
01 01 * * * /usr/local/bin/rsbu -vbd1 ; /usr/local/bin/rsbu -vbd2

# Set the hardware clock to keep it in sync with the more accurate system clock
03 05 * * * /sbin/hwclock --systohc

# Perform monthly updates on the first of the month
# 25 04 1 * * /usr/bin/dnf -y update

For more details on crontab, please visit:
https://opensource.com/article/17/11/how-use-cron-linux


Thanks for watching...
========================================================

Postfix Configuration:
https://www.youtube.com/watch?v=hc-FTkl9WrQ

Kickstart Installation using FTP in Linux:
https://www.youtube.com/watch?v=f8FxQnUkOl0&t=9s

Configure Local Yum Repository:
https://www.youtube.com/watch?v=-N09WSCNcso&t=3s

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Schedule Future Tasks in Linux Using at Command and Crontab», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.