linux ¶¨Ê±ÈÎÎñ crontab Ïêϸ½âÊÍ
linux ¶¨Ê±ÈÎÎñ crontab Ïêϸ½âÊÍ
cron ÊÇlinuxµÄÄÚÖ÷þÎñ£¬µ«Ëü²»×Ô¶¯ÆðÀ´£¬¿ÉÒÔÓÃÒÔϵķ½·¨Æô¶¯¡¢¹Ø±ÕÕâ¸ö·þÎñ£º
ÒýÓÃ:
/sbin/service crond start //Æô¶¯·þÎñ
/sbin/service crond stop //¹Ø±Õ·þÎñ
/sbin/service crond restart //ÖØÆô·þÎñ
/sbin/service crond reload //ÖØÐÂÔØÈëÅäÖÃ
//=========================================================================
# Use the hash sign to prefix a comment
# +---------------- minute (0 - 59)
# | +------------- hour (0 - 23)
# | | +---------- day of month (1 - 31)
# | | | +------- month (1 - 12)
# | | | | +---- day of week (0 - 7) (Sunday=0 or 7)
# | | | | |
# * * * * * command to be executed
//=============================================================================
ºÜ¶àʱºò£¬ÄãûÓа취ÖØÐÂÆô¶¯crond£¬Õâ¸öʱºò¿ÉÒÔÏÈkillall crond È»ºóÔÙcrond restart¾ÍŶokÁË¡£
ÄãÒ²¿ÉÒÔ½«Õâ¸ö·þÎñÔÚϵͳÆô¶¯µÄʱºòÒ²×Ô¶¯Æô¶¯£º
ÒýÓÃ:
ÔÚ/etc/rc.d/rc.localÕâ¸ö½Å±¾µÄĩβ¼ÓÉÏ£º
/sbin/service crond start
ÏÖÔÚcronÕâ¸ö·þÎñÒѾÔÚ½ø³ÌÀïÃæÁË£¬ÎÒÃǾͿÉÒÔÓÃÕâ¸ö·þÎñÁË£¬cron·þÎñÌṩÒÔϼ¸ÖÖ½Ó¿Ú¹©´ó¼ÒʹÓãº
1.Ö±½ÓÓÃcrontabÃüÁî±à¼
cron·þÎñÌṩcrontabÃüÁîÀ´É趨cron·þÎñµÄ£¬ÒÔÏÂÊÇÕâ¸öÃüÁîµÄһЩ²ÎÊýÓë˵Ã÷£º
ÒýÓÃ:
crontab -u //É趨ij¸öÓû§µÄcron·þÎñ£¬Ò»°ãrootÓû§ÔÚÖ´ÐÐÕâ¸öÃüÁîµÄʱºòÐèÒª´Ë²ÎÊý
crontab -l //Áгöij¸öÓû§cron·þÎñµÄÏêϸÄÚÈÝ
crontab -r //ɾ³ýû¸öÓû§µÄcron·þÎñ
crontab -e //±à¼Ä³¸öÓû§µÄcron·þÎñ
±ÈÈç˵root²é¿´×Ô¼ºµÄcronÉèÖãº
ÒýÓÃ:
crontab -u root -l
ÔÙÀýÈ磬rootÏëɾ³ýfredµÄcronÉèÖãº
ÒýÓÃ:
crontab -u fred -r
ÔÚ±à¼cron·þÎñʱ£¬±à¼µÄÄÚÈÝÓÐһЩ¸ñʽºÍÔ¼¶¨£¬ÊäÈ룺
ÒýÓÃ:
crontab -u root -e
½øÈëvi±à¼Ä£Ê½£¬±à¼µÄÄÚÈÝÒ»¶¨Òª·ûºÏÏÂÃæµÄ¸ñʽ£º
ÒýÓÃ:
*/1 * * * * ls >> /tmp/ls.txt
Õâ¸ö¸ñʽµÄÇ°Ò»²¿·ÖÊǶÔʱ¼äµÄÉ趨£¬
Ïà¹ØÎĵµ£º
1¡¢±äÁ¿ºÍÔËËã (×¢£º´ÓÉÏÍùÏÂÒ»²½Ò»²½Ö´ÐÐ)
1.±¾µØ±äÁ¿ÔÚÓû§ÏÖÔÚµÄshellÉúÃüÆڵĽű¾ÖÐʹÓÃ
variable-name=value ÀýÈ磺test="test"
2.setÏÔʾ±¾µØËùÓеıäÁ¿
3.Éè³ÉÖ»¶Á±äÁ¿£ºreadonly variable-name ÀýÈ磺test="cynric" »á ......
Ç°ÑÔ
linuxÓÐ×Ô¼ºÒ»Ì×ÍêÕûµÄÆô¶¯Ìåϵ£¬×¥×¡ÁËlinuxÆô¶¯µÄÂöÂ磬linuxµÄÆô¶¯¹ý³Ì½«²»ÔÙÉñÃØ¡£
ÔĶÁ֮ǰ½¨ÒéÏÈ¿´Ò»Ï¸½Í¼¡£
±¾ÎÄÖмÙÉèinittabÖÐÉèÖõÄinit treeΪ£º
/etc/rc.d/rc0.d
/etc/rc.d/rc1.d
/etc/rc.d/rc2.d
/etc/rc.d/rc3.d
/etc/rc.d/rc4.d
/etc/ ......
×÷Õߣº¿µ»ª,»ªÇåÔ¶¼ûǶÈëʽѧԺ½²Ê¦¡£
1. ¹ØÓÚij¸öµµÃûµÄ¡ºÀàÐÍ¡»Õì²â(´æÔÚÓë·ñ)£¬Èç test -e filename
-e ¸Ã¡ºµµÃû¡»ÊÇ·ñ´æÔÚ£¿(³£ÓÃ)
-f ¸Ã¡ºµµÃû¡»ÊÇ·ñΪµµ°¸(file)£¿(³£ÓÃ)
-d ¸Ã¡ºÎļþÃû¡»ÊÇ·ñΪĿ¼(direct ......
ƽʱ¾³£ÓÃlinuxµÄfreeÃüÁî²é¿´ÄÚ´æÐÅÏ¢£¬½ñÌìÒòΪmysqlϵͳͻȻËÀµôÁË£¬¶øÇÒÎÞ·¨Æô¶¯¡£¾ßÌåÏÖÏóÊÇÒ»Ö±ÏÔʾÕýÔÚÆô¶¯µÄ½ø¶È״̬£¬µ«Ê¼ÖÕÎÞ·¨Æô¶¯£¬Æ½Ê±Æô¶¯¼¸Ãë¾ÍÍê³ÉÁ˵ġ£ËùÒԿ϶¨ÓÐÎÊÌâ¡£ÓÚÊÇ×¼±¸²é¿´ÏÂÊDz»ÊÇÈÕÖ¾ÐÅÏ¢¶àÁË£¬Õ¼ÂúÁËÓ²Å̿ռ䡣ͻȻ·¢ÏÖÒ»¸öÎÊÌ⣬Ôõô²é¿´Ò»¸öÎļþºÍĿ¼µÄ¿Õ¼äÕ¼ÓÃÇé¿öÄØ£¬ÒÔÇ°¶¼ÓÃls -al à ......