mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-21 18:37:31 +08:00
cleanup in cli
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* do clean in cli
|
||||
*
|
||||
*/
|
||||
|
||||
require "bittorrent.php";
|
||||
require "cleanup.php";
|
||||
|
||||
$fd = fopen(sprintf('%s/nexus_cleanup_cli.lock', sys_get_temp_dir()), 'w+');
|
||||
if (!flock($fd, LOCK_EX|LOCK_NB)) {
|
||||
do_log("can not get lock, skip!");
|
||||
}
|
||||
register_shutdown_function(function () use ($fd) {
|
||||
fclose($fd);
|
||||
});
|
||||
|
||||
try {
|
||||
docleanup(0, true);
|
||||
do_log("[CLEANUP_CLI DONE!]");
|
||||
} catch (\Exception $exception) {
|
||||
do_log("ERROR: " . $exception->getMessage());
|
||||
throw new \RuntimeException($exception->getMessage());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user