The Cron daemon can execute shell scripts at a specified time. In fact, it is the same as the bat file for job scheduling in windows. # Crontab regularly execute commands (this is my main learning) # at only once # batch system attached when allowed to be scheduled for batch processing cron guard...
The Cron daemon can execute shell scripts at a specified time. In fact, it is the same as the bat file for job scheduling in windows.
# Crontab regularly executes commands (this is my main learning)
# At only once
# The batch system is scheduled for batch processing when the attachment is allowed
During system initialization, the cron daemon will check the crontab file and at record files, and immediately send the changes to the cron daemon for execution.
# Ps-ef | grep cron
Root 3866822 1 0 Feb 01-0: 12/usr/sbin/cron
Root 8519772 7143576 0 15:36:46 pts/5 grep cron
List the scheduled tasks in the system:
# Crontab-l
Province
# US GovernmentUsers Restricted Rights-Use, duplication or
# Disclosurerestricted by gsa adp Schedule Contract with IBM Corp.
#
#0 3 ***/usr/sbin/skulker
#45 2 ** 0/usr/lib/spell/compress
#45 23 *** ulimit 5000;/usr/lib/smdemon. cleanu>/dev/null
0 11 ***/usr/bin/errclear-d S, O 30
0 12 ***/usr/bin/errclear-d H 90
0, 5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55 ****/usr/sbin/dumpctrl-k>/dev/null 2>/dev/null
0 15 ***/usr/lib/ras/dumpcheck>/dev/null2> & 1
55 23 ***/var/perf/pm/bin/pmcfg>/dev/null2> & 1 # Enable PM DataCollection
59 23 ***/var/perf/pm/bin/pmcfg-T>/dev/null2> & 1 # Enable PM Data Transmission
#
Each user can have their own scheduled tasks.
# Su-user
# Crontab-l
The first five * representatives respectively
. ---------------- 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)
|
* *** Command to be executed
For example, after a script is created, you must grant the permission to run it when crontab calls shell.
# Chmod 777 ddd. sh generally cannot be granted 777 permissions
If the scheduled task already exists, you can view it in the/var/spool/cron/crontabs directory.
# Cd/var/spool/cron/crontabs
# Ls
Adm esaadmin root sys uucp
Of course, not every user can use the scheduled task function. Two files are authorized in the AIX task plan.
/Var/adm/cron. deny defines the user that is not allowed
/Var/adm/cron. allow defines the allowed users
If the cron. allow file exists, the crontab command can be used only for users who write their usernames to this file. Of course, if cron. allow exists, the root must be in it.
If both files exist, the crontab command can be executed only by users in the cron. allow file. On the contrary, if neither file exists, only root can execute crontab.
If only the cron. deny file is available, the user that appears in the file cannot execute the command. other users can execute the crontab command.
Note:
Be careful with some traps
-** 15 **/myshell. sh
You can see what the scheduled task is, that is, the script is continuously executed on the 15th day of every month.
The following are some related directory materials found on the Internet:
From wolf