Linux ---------- crontab scheduled tasks of various pit

crontab at runtime environment and user environment is not the same, there may be some cases command can not be found, this time will be introduced to the path of script commands, such as adding the following statement:

PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin

Example:
(1) Value IP
ifconfig eth0
the crontab does not recognize the path ifconfig, naturally fail to value, the result is displayed as blank

(2) monitor memory, the CPU
Top -b -n 1> test.txt
Top is an interactive command default command, you must force coupled with the -b option, otherwise the results appear to be empty

Guess you like

Origin www.cnblogs.com/wangchengshi/p/12101425.html
Recommended