|
|
@ -16,32 +16,32 @@ if (php_sapi_name() != 'cli') { |
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Lock multi-thread execution |
|
|
|
// Stop CLI execution on cleaner process running |
|
|
|
$semaphore = sem_get(crc32('crontab.crawler'), 1); |
|
|
|
$semaphore = sem_get(crc32('crontab.cleaner'), 1); |
|
|
|
|
|
|
|
|
|
|
|
if (false === sem_acquire($semaphore, true)) { |
|
|
|
if (false === sem_acquire($semaphore, true)) { |
|
|
|
|
|
|
|
|
|
|
|
CLI::danger(_('process locked by another thread.')); |
|
|
|
CLI::danger(_('stop crontab.cleaner is running in another thread.')); |
|
|
|
CLI::break(); |
|
|
|
CLI::break(); |
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Stop CLI execution on cleaner process running |
|
|
|
// Stop CLI execution on crawler process running |
|
|
|
$semaphore = sem_get(crc32('crontab.cleaner'), 1); |
|
|
|
$semaphore = sem_get(crc32('crontab.crawler'), 1); |
|
|
|
|
|
|
|
|
|
|
|
if (false === sem_acquire($semaphore, true)) { |
|
|
|
if (false === sem_acquire($semaphore, true)) { |
|
|
|
|
|
|
|
|
|
|
|
CLI::danger(_('stop crontab.cleaner is running in another thread.')); |
|
|
|
CLI::danger(_('stop crontab.crawler is running in another thread.')); |
|
|
|
CLI::break(); |
|
|
|
CLI::break(); |
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Stop CLI execution on crawler process running |
|
|
|
// Lock multi-thread execution |
|
|
|
$semaphore = sem_get(crc32('crontab.crawler'), 1); |
|
|
|
$semaphore = sem_get(crc32('cli.yggo'), 1); |
|
|
|
|
|
|
|
|
|
|
|
if (false === sem_acquire($semaphore, true)) { |
|
|
|
if (false === sem_acquire($semaphore, true)) { |
|
|
|
|
|
|
|
|
|
|
|
CLI::danger(_('stop crontab.crawler is running in another thread.')); |
|
|
|
CLI::danger(_('process locked by another thread.')); |
|
|
|
CLI::break(); |
|
|
|
CLI::break(); |
|
|
|
exit; |
|
|
|
exit; |
|
|
|
} |
|
|
|
} |
|
|
|