2

同時に実行している 2 つの PHP スクリプトがあります。そのうちの 1 つ ( SleepingScript.php) が関数を呼び出しsleepます。他のスクリプト ( WakeScript.php) は、必要に応じてスリープ状態のスクリプトを起動できる必要があります。

どうすればこれを達成できますか?

状況をよりよく説明するコードを次に示します。

SleepingScript.php

<?php
   $myPid = getmypid();
   /* save $myPid to database or file */
   sleep( 120 );
   /* other statements executed after 2 minutes or when woken up by WakeScript */
?>

WakeScript.php

<?php
    /* ... */
    if( $wakeUpNeeded ) {
      $pid = readSavedPid();
      wake( $pid );
    }
?>
4

1 に答える 1