linux϶¨Ê±Ö´Ðмƻ®ÈÎÎñ
linux϶¨Ê±Ö´Ðмƻ®ÈÎÎñ
²é¿´/etc/crontabÎļþ
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly
Ç°ËÄÐÐÊÇÓйØÉèÖÃcronÈÎÎñÔËÐеĻ·¾³±äÁ¿. SHELL±äÁ¿µÄÖµÖ¸¶¨ÏµÍ³Ê¹ÓõÄSHELL»·¾³(¸Ã ÑùÀýΪbash shell)£¬PATH±äÁ¿¶¨ÒåÁËÖ´ÐÐÃüÁîµÄ·¾¶¡£CronµÄÊä³öÒÔµç×ÓÓʼþµÄÐÎʽ·¢¸øMSILTO±ä Á¿¶¨ÒåµÄÓû§Ãû. Èç¹ûMAILTO±äÁ¿¶¨ÒåΪ¿Õ×Ö·û´®(MAILTO=""), µç×ÓÓʼþ²»»á±»·¢ËÍ. Ö´ÐÐÃüÁî»ò½Å±¾Ê±HOME±äÁ¿¿ÉÓÃÀ´ÉèÖüÒĿ¼¡£
Îļþ/etc/crontabÖÐÿÐÐÈÎÎñµÄÃèÊö¸ñʽÈçÏÂ:
minute hour day month dayofweek command
minute - ´Ó0 µ½ 59µÄ ÕûÊý
hour - ´Ó0µ½23µÄ ÕûÊý
day - ´Ó1µ½31µÄ ÕûÊý (±ØÐëÊÇÖ¸¶¨Ô·ݵÄÓÐЧÈÕÆÚ)
month - ´Ó1µ½12µÄ ÕûÊý (»òÈçJan»òFeb¼òдµÄÔ·Ý)
dayofweek - ´Ó0µ½7µÄÕûÊý,0»ò7ÓÃÀ´ÃèÊöÖÜÈÕ (»ò ÓÃSun»òMon¼ò дÀ´±íʾ)
command - ÐèÒªÖ´ÐеÄÃüÁî(¿ÉÓÃas ls /proc >> /tmp/proc»ò Ö´ÐÐ×Ô¶¨Òå½Å±¾µÄÃüÁî)
root±íʾÒÔrootÓû§Éí·ÝÀ´ÔËÐÐ
run-parts±íʾºóÃæ¸ú×ŵÄÊÇÒ»¸öÎļþ¼Ð£¬ÒªÖ´ÐеÄÊǸÃÎļþ¼ÐϵÄËùÓнű¾
¶ÔÓÚÒÔÉϸ÷Óï¾ä,ÐÇ ºÅ(*)±í ʾËùÓпÉÓõÄÖµ. Àý Èç,*ÔÚ Ö¸´úmonthʱ±íʾÿÔÂÖ´ÐУ¨ÐèÒª·ûºÏÆäËûÏÞÖÆÌõ¼þ£©¸ÃÃüÁî¡£
ÕûÊý¼äµÄÁ¬×ÖºÅ(-)±í ʾÕûÊýÁÐ,Àý Èç1-4Òâ ˼ÊÇÕûÊý1,2,3,4.
Ö¸¶¨ÊýÖµÓɶººÅ·Ö¿ª¡£È磺3,4,6,8±í ʾÕâËĸöÖ¸¶¨ÕûÊý.
·ûºÅ“/”Ö¸¶¨²½½øÉèÖÃ.“/<interger>”±íʾ²½½øÖµ¡£Èç0-59/2¶¨ÒåÿÁ½·ÖÖÓÖ´ÐÐÒ»´Î¡£²½½øÖµÒ²¿ÉÓÃÐǺűíʾ¡£Èç*/3ÓÃÀ´ÔËÐÐÿÈý¸öÔ·ÝÔËÐÐÖ¸¶¨ÈÎÎñ.
ÒÔ“#”¿ªÍ·µÄΪעÊÍÐÐ,²»»á±»Ö´ÐС£
Èç¹ûÒ»¸öcronÈÎ ÎñÐèÒª¶¨ÆÚ¶ø²»ÊÇ°´Ð¡Ê±,Ìì,ÖÜ,ÔÂÀ´Ö´ÐÐ,ÔòÐèÒªÌí¼Ó/etc/cron.dĿ¼. Õâ¸öĿ¼ÏµÄËùÓÐÎļþºÍÎļþ/etc/crontabÓï·¨Ïàͬ. ²é¿´ÑùÀý
# record the memory usage of the system every monday
# at 3:30AM in the file /tmp/meminfo
30 3 * * mon cat /proc/meminfo >> /tmp/meminfo
# run custom scrīpt the first day of every month at 4:10AM
10 4 1 * * /root/scrīpts/backup.sh
³ýÁËrootÓû§Ö®ÍâµÄÓû§¿ÉÒÔÖ´ÐÐcrontabÅäÖüƻ®ÈÎÎñ¡£ËùÓÐÓû§¶¨ÒåµÄcrontab
Ïà¹ØÎĵµ£º
°²×°£¬Éý¼¶ºÍжÔØÓ¦ÓÃÈí¼þÊÇÓ°ÏìÓû§¶Ô²Ù×÷ϵͳÆÀ¼ÛµÄ¾ö¶¨ÐÔÒòËØÖ®Ò»¡£¶ÔÓÚÈÕ½¥Á÷ÐÐµÄ GNU/Linux ²Ù×÷ϵͳ£¬ÓµÓмò½àÇ¿´óµÄÈí¼þ°ü¹ÜÀí»úÖƹ¦²»¿Éû¡£±¾ÎÄ´Ó»ù±¾µÄ rpm/dpkg ÃüÁîÐгö·¢£¬ÒÔ RHEL ºÍ UBUNTU ΪÀý£¬½éÉܵäÐÍ Linux ϵͳÖÐÓ¦ÓÃÈí¼þµÄ¹ÜÀíºÍʹÓá£
RPM/DPKG Á½´óÕóÓª¼ò½é
ÔÚ GNU/Linux( ÒÔϼò³Æ Linux) ²Ù×÷Ï ......
¡ð
¡¢ËµÃ÷
±Ê¼ÇÊÊÓÃÓÚ
Linux
µÄ
2.6.10
ÒÔºóµÄÄںˡ£
±Ê¼ÇÒÔ
Linux
Device
Driver3
ÌṩµÄ
scull
³ÌÐò
(scull
Ŀ¼ÖеÄ
main.c
ºÍ
scull.h)
Ϊ¼Ç¼Ö÷Ïߣ¬²¢ÒÔ¸ÃÇý¶¯³ÌÐòÖеĸ÷ÖÖϵͳµ÷Óúͺ¯Êýµ÷ÓÃÁ÷³ÌΪ¼Ç
¼˳Ðò¡£±ÈÈ磬
module_init( )
ºÍ
module_exit(
)
ΪÏà¶ÔÓ¦µÄÒ»¶Ôϵͳµ÷Óã¬Ò»°ãÊé¼®Öж ......
˵ʵ»°£¬ÐźÅÊÇÎÒÌÖÑáµÄ¶«Î÷£¬ÔÚÎÒЩµÄ´úÂëÖУ¬ÎÒ¶¼ÏëÓÃ×î¼òµ¥µÄ°ì·¨À´´¦ÀíËü£¬ÏÖÔÚÓöµ½¶àÏß³ÌÖÐÐźŵĴ¦Àí£¬APUEÖеÄ˵·¨Ò²¿´µÃ²»ÊǺܶ®£¬CSDNÖÐһλÅóÓÑÓÐÈçϵÄ×ܽᣬÏȼÇÔÚÕâÀï¡£
1. ĬÈÏÇé¿öÏ£¬ÐźŽ«ÓÉÖ÷½ø³Ì½ÓÊÕ´¦Àí£¬¾ÍËãÐźŴ¦Àíº¯ÊýÊÇÓÉ×ÓÏß³Ì×¢²áµÄ
2. ÿ¸öÏ߳̾ùÓÐ×Ô¼ºµÄÐźÅÆÁ±Î×Ö£¬¿ÉÒÔʹÓÃsigprocmaskº¯ ......
cronÊÇÒ»¸ölinuxϵĶ¨Ê±Ö´Ðй¤¾ß£¬¿ÉÒÔÔÚÎÞÐèÈ˹¤¸ÉÔ¤µÄÇé¿öÏÂÔËÐÐ×÷Òµ¡£ÓÉÓÚCron ÊÇLinuxµÄÄÚÖ÷þÎñ£¬µ«Ëü²»×Ô¶¯ÆðÀ´£¬¿ÉÒÔÓÃÒÔϵķ½·¨Æô¶¯¡¢¹Ø±ÕÕâ¸ö·þÎñ£º
¡¡¡¡/sbin/service crond start //Æô¶¯·þÎñ
¡¡¡¡/sbin/service crond stop //¹Ø±Õ·þÎñ
¡¡¡¡/sbin/service crond restart //ÖØÆô·þÎñ
¡¡¡¡/sbin/service cron ......
linuxϼ¸ÖÖ·þÎñÆ÷µÄÅäÖÃʹÓÃÖ®Ò»£ºnfs tftp
°²×°nfsÐèÒªÔÚ·þÎñÆ÷¶Ë¹Ø±Õiptables·À»ðǽ£¬¹Ø±Õ·½·¨ÈçÏÂ
²é¿´·À»ðǽ״̬£º
/etc/init.d/iptables status
ÔÝʱ¹Ø±Õ·À»ðǽ£º
/etc/init.d/iptables stop
½ûÖ¹·À»ðǽÔÚϵͳÆô¶¯Ê±Æô¶¯
/sbin/chkconfig --level 2345 iptables off
ÖØÆôiptables:
/etc/init.d/iptabl ......