Sorry if this question was asked before, however I could not find anything relevant in the search.
I currently have a PHP script that checks the database for the next record that has not been updated. My question is this: if I then update the database to show that the record is being processed during the cron job (which takes about 30 seconds), and the cron job starts every second, and in the second 1 the cron job is executed, but will Is this job waiting for completion before completing the cron job for the second time or will it run with the second 2?
thanks
cronjob - php script, cron script, script.
, - :
$LOCK_FN = "/tmp/my-script.lock" if(file_exists ($LOCK_FN)){ //previous script is not finish exit. die("Previous script is not finished yet."); } //Create lock $fp = fopen($LOCK_FN,"w"); fclose($fp); /* Put your script logic here */ //Open the lock work is done. unlink($LOCK_FN)
, - . , script , .
<?php $port = 1080; // choose unused port $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if (!$sock) { exit; } socket_set_nonblock($sock); if (!socket_bind($sock, "127.0.0.1", $port)) { exit; } while(1) { ... } ?>
script.
script Crontab * * * * *
cronjob , . , , . php script
Source: https://habr.com/ru/post/1617536/More articles:Drupal 8, programmatically enter a list of custom content fields - drupal-8Error: Cannot find module "js-yaml" when running "bower install" - angularjsmaximum number of elements located on the left? - htmlHow to get multiple processes to read the same documents - mongodbMYSQL trigger that externally runs a PHP script - phpdplyr frame_data errors with "Columns are not the same" - rПоведение команды Bad 'ls' в пользовательской простой оболочке - cExtract words between double quotes in variable R - regexHow to get the type of array elements? - arraysAlt attribute for ASCII art in HTML? - htmlAll Articles