file get contents - php file_get_contents executes twice -


i have created script check in backup tapes our tape library , check them in tsm. script activated sms.

our sms server receives command start check-in , executes script on tsm server file_get_contents command.

i have issue script being executed twice when there allot of tapes check in(+20). results errors on out tsm server because move media commands allso double.

i overcame putting in inital timestamp logging when first file_get_content started commands arent executed twice. allthough fixes double command issue still presents problem because sms server sends confirmation script started or not. means on every check in +20 tapes, operator gets 2 messages, 1 saying check in failed, other check in started.

i suspect caused because of time takes commands passed onto tsm server (can take upto 45seconds).

long story short, there way can set sort of longer timeout, or give parameter/checks prevent behaviour? in advance. paths replaced *****.

sms server code     //drm checkin             if($auth == 1 , strtolower($sms_body) == "******"){                 $knowncommand = 1;                 $url = "http://*******/******/checkin.php?remote&exec&sender=" . $from;                 $dodrm = file_get_contents($url);                 if ($stmt2 = $mysqli->prepare("update messagein set checked = 1 checked = 0 ")) {                     $stmt2->execute();                     $stmt2->close();                 }             } 

tsm server script code:

if(isset($_get['exec'])){     if(isset($_get['remote'])){         $rcs = checkremotecheckinstatus();         $to = $_get['sender'];         //execute drm check-in         $commit = checkbuttonstatus();         if($commit == "" , $rcs == 0){             setremotecheckinstatus();             $psdir = "*****";             $psscript = "drm_checkin_retrieve.ps1";             $runcmd = $pspath. ' -executionpolicy remotesigned '.$psdir.$psscript;             exec($runcmd, $out);             setcheckinstatus();             $psdir = "*****";             $psscript = "queuesms.ps1 $to 'check-in gestart...'";             $runcmd = $pspath. ' -executionpolicy remotesigned '.$psdir.$psscript;             exec($runcmd, $out);         }         else{             //send failed sms             $psdir = "*****";             $psscript = "queuesms.ps1 $to 'fout: geen check-in mogelijk.'";             $runcmd = $pspath. ' -executionpolicy remotesigned '.$psdir.$psscript;             exec($runcmd, $out);         }     }     else{         $psdir = "*******";         $psscript = "drm_checkin_retrieve.ps1";         $runcmd = $pspath. ' -executionpolicy remotesigned '.$psdir.$psscript;         exec($runcmd, $out);         echo "check-in gestart...<br><br>";         setcheckinstatus();     } } 

if have access php.ini, topic can usefull

if want increase timeout in specific script, can use set_time_limit

or way, @ beginning of php script :

ini_set('max_execution_time', 120); //120 seconds 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -