tourze/workerman-core-dump-cleaner
最新稳定版本:0.1.0
Composer 安装命令:
composer require tourze/workerman-core-dump-cleaner
包简介
CoreDump文件清理
README 文档
README
A simple package to automatically clean up core dump files in Workerman applications.
Features
- Automatically cleans up core dump files (
core,core.1,core.2, etc.) - Configurable cleanup schedule using cron expression
- Simple integration with Workerman applications
- Monitors up to 20 core dump files (core to core.19)
Requirements
- PHP >= 8.1
- Workerman >= 5.1
- Workerman/Crontab >= 1.0.7
Installation
composer require tourze/workerman-core-dump-cleaner
Quick Start
<?php use Tourze\Workerman\CoreDumpCleaner\CoreDumpCleaner; // Initialize with project directory and optional cron schedule // Default schedule is every 30 seconds new CoreDumpCleaner('/path/to/project', '*/30 * * * * *');
Configuration
The constructor accepts the following parameters:
$projectDir(string): The directory where core dump files are located$rule(string): Cron expression for cleanup schedule (default:*/30 * * * * *)$maxCoreFiles(int): Maximum number of core files to monitor (default: 20)$registerCrontab(bool): Whether to register the cron job automatically (default: true)
Advanced Usage
<?php use Tourze\Workerman\CoreDumpCleaner\CoreDumpCleaner; // Custom configuration $cleaner = new CoreDumpCleaner( projectDir: '/path/to/project', rule: '0 */10 * * * *', // Every 10 minutes maxCoreFiles: 50, // Monitor up to 50 core files registerCrontab: true // Auto-register cron job ); // For testing purposes (disable cron registration) $cleaner = new CoreDumpCleaner( projectDir: '/path/to/project', registerCrontab: false ); // Manual cleanup $results = $cleaner->cleanFiles();
Contributing
Please feel free to submit pull requests or open issues to improve this package.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 20
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-24