1) Add a scheduled task
CRONTAB-E will use an editor to open a file, and then enter the scheduled tasks to be performed, after saving, under/var/spool/cron/crontabs/, a file named after the user name will appear.
2) How to add a scheduled task
Each row in the file contains six fields, the first five of which are the time the specified command was executed, and the last field is the command to be executed.
Spaces or tabs are used to separate each field. The format is as follows:
Minute hour day-of-month month-of-year day-of-week commands
In addition to the numbers there are several special symbols that are "*", "/" and "-", ",", * represent all the values within the range of the number, "/" for each meaning, "/" for each of the 5 units, "-" represents from a number to a number, "," separate several discrete numbers.
Several examples:
every morning at 6
0 6 * * echo "Good morning." >>/tmp/test.txt//Note simply Echo, no output from the screen Because cron emails any output to Root's mailbox.
every two hours,
0 */2 * * * echo "has a break now." >>/tmp/test.txt
11 o'clock to 8 a.m. every two hours and early Eight o '
0 23-7/2,8 * * * echo "have a good dream" >>/tmp/test.txt
4th per month and Monday to Friday, three a.m. 11
0 4 * 1-3 command line
January 1 morning 4
0 4 1 1 * command line Shell=/bin/bash Path=/sbin:/bin:/usr/sbin:/usr/bi n Mailto=root//If there is an error, or if there is data output, the data is sent to this account as mail home=/
executes scripts within/etc/cron.hourly per hour
"* * * * Root run-parts/ Etc/cron.hourly
Execute scripts within/etc/cron.daily every day
4 * * * root run-parts/etc/cron.daily
Perform/etc/every week Script within cron.weekly
4 * * 0 root run-parts/etc/cron.weekly
Execute script within/etc/cron.monthly per month;
42 4 1 * * Root run-parts/etc/cron.monthly
Note: "Run-parts" is the parameter, if you remove this parameter, you can write a script name to run, instead of the folder name.
3) Problem: In the embedded development, found embedded Linux system input CRONTAB-E error
Crontab:chdir (/var/spool/cron/crontabs): No such file or directory
Workaround:
Mkdir-p/var/spool/cron/crontabs
Since the/var folder is the virtual folder of the kernel and the changes are all gone after the reboot, it can be implemented by self-launching script
Mkdir-p/var/spool/cron//root/root/var/spool/cron/777/var/spool/cron/crontabs/rootcrond
It is not possible to use ' ~ ' because it is executed before login
4) View process consuming memory
The Crond process starts a script implementation on a timed basis, with the following script
Pid= ' PS |grep xxx|sed-n 1p|awk ' {print $} '>>/proc/$PID/status |grep vmsize >> $FILE
Self-modifying according to your kernel printing
All referenced articles and URLs
Crontab Related:
Add timed tasks under Linux
The method of using BusyBox Crond service under embedded Linux
Using BusyBox's Crond service
Linux crontab Timed Task Configuration method (detailed)
View process-related
http://bbs.csdn.net/topics/360001628 (second floor most useful)
View the memory that a program is running under Linux
How much memory is used by processes in Linux under the accuracy amount
Crond Daemon implements timing monitoring of the size of a process that occupies memory