Task Scheduler: Backup data at specific times, restart services, shell scripts, individual commands, and more.
Task Scheduler Profile: Cat/etc/crontab
[Email protected] ~]# Cat/etc/crontab
Shell=/bin/bash
Path=/sbin:/bin:/usr/sbin:/usr/bin
Mailto=root
# for details see Mans 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
Shell script, PATH environment variable, mailto send mail to WHO
Time:
Minutes, hours, days of the month, month, week, and finally, commands that need to be executed.
CRONTAB-E the task plan that needs to be performed.
Scripts executed 3 o'clock in the morning per day
0 3 * * */bin/bash/usr/local/sbin/123.sh >>/tmp/123.log 2>>/tmp/123.log
1 to 10th of the 3 points of the month can be divisible by 2, Week 2 and Week 5,
0 3 1-10 */2 2,5/bin/bash/usr/local/sbin/123.sh>>/tmp/123.log 2>>/tmp/123.log
To use an absolute path, for example iptables can be written as an absolute path or added to path
/usr/sbin/iptables
Start the service:
Systemctl Start Crond.service
To see if it starts:
PS aux |grep
Or:
Systemctl Status Crond
Crontab-u,-E,-L,-R
Format: Time-sharing Week user command
File/var/spool/cron/username
Sub-range 0-59, time range 0-23, day range 0-31, month range 0-12, week 1-6
Available formats 1-5 indicates a range of 1 to 5
Available formats 1 or 2 or 3
Available formats */2 represent numbers that are divisible by 2, such as hours, that is, every 2 hours to ensure that the service is in the boot state
Linux Task Scheduler