cron - Crond execute shell many times -


i have following timey.cpp code in redhat 2.6.32 x86_64:

using namespace std ; int main() {     while( 1 ){         char x[64]={0} ;         strcpy( x,"1234567890") ;         std::string s = x ;         std::cout << "(" <<  x << ")" << std::endl ;         struct timeval localtimex ;         long secs,usecs ;         gettimeofday(&localtimex,0x00) ;         secs  = localtimex.tv_sec ;         usecs = localtimex.tv_usec ;         //long mills = (time.tv_sec * 1000) + (time.tv_usec / 1000 ) ;         printf("secs=(%d),usecs=(%d)\n",secs,usecs) ;         sleep( 1 ) ;     } //while  } 

in /home/informix/test, compiled g++ --std=c++0x timey.cpp -o timey.exe, , shell timey.sh:

    source /etc/bashrc     nohup /home/informix/test/timey.exe & 

then run timey.sh by:

    /home/informix/test/timey.sh 

and take if timey.exe runs by:

    ps -ef | grep timey 

it seems timey.exe runs expected:

    informix 41340     1  0 10:32 pts/10   00:00:00 /home/informix/test/timey.exe 

what confuses me add shell crontab:

    38 10 * * 1-5 informix /home/informix/test/timey.sh 

and restart crond:

    /etc/init.d/crond restart 

what surprises me see 4 copies of timey.exe running:

    ps -ef | grep timey     informix 41498     1  0 10:38 ?        00:00:00 /home/informix/test/timey.exe     informix 41499     1  0 10:38 ?        00:00:00 /home/informix/test/timey.exe     informix 41529     1  0 10:38 ?        00:00:00 /home/informix/test/timey.exe     informix 41561     1  0 10:38 ?        00:00:00 /home/informix/test/timey.exe 

what did wrong 4 copies of timey.exe running?

i see following in /var/log/cron:

jul  2 10:38:01 localhost crond[41440]: (informix) cmd (/home/informix/test/timey.sh ) jul  2 10:38:01 localhost crond[41439]: (informix) cmd (/home/informix/test/timey.sh ) jul  2 10:38:01 localhost crond[41491]: (informix) cmd (/home/informix/test/timey.sh ) jul  2 10:38:01 localhost crond[41533]: (informix) cmd (/home/informix/test/timey.sh ) 

it seems crond ran timey.sh 4 times, why?

also:

  • in redhat 2.6.32-279.el6.x86_64, works!
  • in redhat 2.6.32-358.el6.x86_64, not work!


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -