Preliminary solution of at/cron scheduled tasks

at plan solution

1. at command:

at [option] TIME
common options:
-V Display version information:
-l: List jobs waiting to run in the specified queue; equivalent to atq
-d: delete the specified job; equivalent to atrm
-c: View specific job tasks
-f /path/from/somefile: read the task from the specified file
-m: when the task is completed, will send an email to the user, even if there is no standard output
Note: the standard output and errors in the result of the job execution command are notified by email Give the relevant user
TIME: define when to do the task at
HH:MM [YYYY-mm-dd]
noon, midnight, teatime(4pm)
tomorrow
now+#{minutes,hours,days, OR weeks}

Second, the synchronization time

In many production environments, the time is very strict, and the time is very important when synchronizing:
1. ntpdata IP
2. Add server IP ibrust to vim /etc/chrony.conf3. Boot and start the service.

Preliminary solution of at/cron scheduled tasks

systemctl enable chronyd
systemctl status chronyd
systemctl start chronyd

time to complete synchronization

3. Cron periodic plan

System cron task: System maintenance job
/etc/crontab
User cron task:
crontab command
#Example of job definition:

Preliminary solution of at/cron scheduled tasks

* * * * * user-name command to be executed
Run the echo command at 9:10 PM
10 21 * * * centos /bin/echo "Howdy!"

Fault status: restart after restart is added to the scheduled task, infinite restart fault

vim /etc/crontab
@reboot root reboot

centos7 troubleshooting:

bootmenu---- kernel--- e
linux16 $ rd.break ---->ctrl+x
mount -o remount,rw /sysroot
vi /sysroot/etc/crontab
del @reboot root reboot

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325322128&siteId=291194637