linuxÒ»¸ösleepµÄÆæ¹ÖÎÊÌ⣬¸ßÊÖÀ´¸ø½â´ðÏÂÁË
while(1)
{
time_t now;
time(&now);
struct tm* pt=localtime(&now);
cout < < "µ±Ç°Ê±¼ä" < < pt->tm_min < < endl;
if((pt->tm_min)%5 == 0)
{
cout < < "ÔÚ" < < pt->tm_min < < "·ÖÖÓ³ÌÐòÖ´ÐÐ" < < endl;
g_pfile->AnalysisFile(data.c_str());
}
#ifdef WIN32
sleep(60000);
#else
sleep(60);
#endif
}
Õâ¸ö³ÌÐòÖ´Ðнá¹û£º
µ±Ç°Ê±¼ä£º11
µ±Ç°Ê±¼ä£º11
µ±Ç°Ê±¼ä£º12
µ±Ç°Ê±¼ä£º13
¡£¡£¡£
дÕâ¸ö³ÌÐò ÊÇÒ»Ö±ÔËÐÐµÄ Ã»Îå·ÖÖÓÖ´ÐÐÒ»´Î
ÿһ·ÖÖÓÅжÏÏÂʱ¼ä
µ«ÊÇΪʲôµÚÒ»´Îsleep£¨60£©Ã»ÓÐÆð×÷Óã¿£¿£¿
Õâ¸öÎÊÌâÈÃÎÒºÜÒÉ»ó£¬ÎÒ·´¸´Ð´´úÂë²âÊÔÁË£¬È·ÊµµÚÒ»´Îsleep£¨£©Ã»Æð×óÓÒ
µÚ¶þ´Îsleep ²Å³É¹¦
¾²âÊÔ£¬Ã»ÎÊÌâ
struct timespec thd_sleep,tmpsleep;
thd_sleep.tv_sec = 60;
thd_sleep.tv_nsec = 0;
nanosleep(&chThd_sleep,&chTmpsleep);
//=========================
sleep¾Ý˵ÊDz»°²È«µÄ¡£ÓÃÉÏÃæµÄµÄ°É
ѧϰÁË
ÓеĻú×ÓÓÐÕâ¸öÎÊÌ⣬ËäÈ»²»¶à£¬µ
Ïà¹ØÎÊ´ð£º
ʹÓÃPHPµÄexecº¯Êýµ÷ÓÃlinuxµÄshellÃüÁÈçdateÈ¥ÐÞ¸Äʱ¼ä»òshutdownȥʵÏֹػú/ÖØÆô£¬µ«ÊÇ·µ»ØÖµ¶¼ÊÇʧ°ÜµÄ¡£¾¹ý¶à´ÎÊÔÑ飬È϶¨ÊÇûÓÐȨÏÞµÄÎÊÌâ¡£
ËùÒÔ£¬Ð¡µÜÔÚ´ËÇë½Ì¸÷룬ÈçºÎ²ÅÄÜÉèÖÃȨÏÞ£¬µ÷ÓÃlinux shellà ......
ÎÒµÄÒâ˼ÊÇ£º
ÔÚ²»¸ü¸ÄÔÀ´µÄÎļþ¼ÐËùÓÐÈË£¬ËùÓÐ×飬ÆäËûÈËȨÏÞµÄÇé¿öÏ£¬µ¥¶À¸øÎļþ¼ÐÊÚȨijÓû§
±ÈÈç/var/www Õâ¸öÎļþ¼Ð£¬ÔÀ´ÏµÍ³ÓÐĬÈϵÄÊôÖ÷ºÍÊô×飬ÎÒÏÖÔÚ²»ÏëÈ¥¸ÄËüÔÀ´µÄÉ趨£¬Ö»ÊÇÏë¸øËüÔö¼ ......
ÎÒҪд¸ö·þÎñ¶Ë¡£ ÒªÇóͬʱ֧³Öwindows ºÍ linux Á½¸ö ϵͳ¡£ Ò²¾ÍÊÇҪдһ¸ö dllºÍÒ»¸öso Îļþ¡£ÓÉÓÚÎÒÒ»Ö±¶¼ÊÇÔÚwindsÏÂд³ÌÐò¡£linuxµÄ»¹²»»á¡£ Ïò´ó¼Ò×Éѯ ͬʱ Ö§³Ö dllºÍso Ó¦¸ÃÔõôд¡£
Óô¿c/c ......
ÎÒÔÚLINUXÉÏÓÐÁ½¸öÓû§
Ò» root
¶þ myadmin
¡¾myadmin@localhost~¡¿$ dir
Desktop myphp
[myadminlocalhost~]$ cd myphp¡¢DesktopÄܽøÈ¥ÆäËûµÄϵͳĿ¼½ø²»È¥
Ö»ÓÐÕâÁ½¸öĿ¼ ÎÒÏë½øÈëÆäËûµÄÏ ......