When editing the Cron service, the edited content has some formatting and conventions, type:crontab-U root-e into the vi editing mode, the content of the edit must conform to the following format:
*/1 * * * * ls >>/tmp/ls.txt
The first part of this format is the time setting, the next part is the command to execute, if you want to execute too many commands, you can write these commands into a script, and then call this script directly here, you can recall the full path of the command when the call. Time setting we have a certain agreement, the preceding five * number represents five numbers, the value range and meaning of the numbers are as follows:
Minutes (0-59)
Hours (0-23)
Date (1-31)
Month (1-12)
Week (0-6)//0 on behalf of Sunday
In addition to the numbers there are several special symbols are "*", "/" and "-", ",", * represents all the values within the range of the number, "/" for each meaning, "*/5" means every 5 units, "-" represents from a number to a number, "," separate several discrete numbers. Here are a few examples to illustrate the problem:
Every morning at 6.
0 6 * * echo "Good morning." >>/tmp/test.txt//Note simply Echo, no output is visible from the screen, because cron emails any output to root.
Every two hours
0 */2 * * echo "has a break now." >>/tmp/test.txt
Every two hours between 11 o'clock and 8 in the morning, eight in the morning.
0 23-7/2,8 * * * echo "a good Dream:)" >>/tmp/test.txt
Every month, number 4th and Monday to Sunday, three a.m., 11.
0 4 * 1-3 command line
January 1 morning, 4.
0 4 1 1 * command line
Each time you finish editing a user's cron settings, Cron automaticallyAr/spool/cron generate a file with the same name as this user, this user's cron information is recorded in this file, this file can not be directly edited, can only be edited with crontab -E. After Cron starts, read the file once every one of the clocks, and check to see if you want to execute the command inside. Therefore, the Cron service does not need to be restarted after this file has been modified. dpca~dsim~ Cheng 2015-10-08 15:47:14 View front and back messages
log File Description:
Ar/log/message system startup information and error log, which is one of the most commonly used logs in red Hat Linux
Ar/log
Cure security-related log information
ar/log/maillog Message-related log information
Ar/log/cron Log information related to timed tasks
Ar/log/spooler log information related to UUCP and news devices
ar/log/ boot.log Daemon starts and stops related log messages
System:
# uname -a # View kernel/operating system/CPU information
# Cat /etc/issue
# cat /etc/redhat-release # View operating system version enterprise Linux Enterprise Linux Server release 5.1 (Carthage) Enterprise Linux Server version Carthage
# cat /proc
uinfo # View CPU Information
# hostname # view computer name
# lspci -tv # List all PCI devices
# lsusb -tv # List all USB devices
# lsmod # lists the loaded kernel modules
# env # View Environment Variables
Resource:
# free -m # View memory usage and swap usage
# df -h # view each partition usage
# du -sh < directory name > # View the size of the specified directory
# grep MemTotal /proc/meminfo # View Total Memory
# grep memfree /proc/meminfo # View idle memory
# uptime # View System uptime, number of users, load
# cat /proc/loadavg # View system load
disks and partitions:
# mount | column -t # View the status of the attached partition
# fdisk -l # View all partitions
# swapon -s # View all swap partitions
# hdparm - I /dev A # View disk parameters (for IDE devices only)
# DMESG | grep IDE # View IDE device detection status at startup
Internet:
# ifconfig # View the properties of all network interfaces
# iptables-l # View firewall settings
# route-n # View the routing table
# netstat-lntp # View all listening ports
# NETSTAT-ANTP # View all established connections
# netstat-s # View Network statistics
Process:
# ps-ef # View All Processes
# top # Real-time display of process status (in another article there is a detailed introduction)
User:
# w # View active Users
# ID < user name > # view specified user information
# last # View user log in log
# cut-d:-f1/etc/passwd # View All users of the system
# cut-d:-f1/etc/group # View all system groups
#crontab-L # View current user's scheduled tasks
Service:
# chkconfig–list # List all system services
# Chkconfig–list | grep on # Lists all startup system services
Program:
# rpm-qa # View all installed Packages
Linux crontab and other commands