定制 tourze/workerman-core-dump-cleaner 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tourze/workerman-core-dump-cleaner

最新稳定版本:0.1.0

Composer 安装命令:

composer require tourze/workerman-core-dump-cleaner

包简介

CoreDump文件清理

README 文档

README

English | 中文

Latest Version Total Downloads PHP Version Coverage Status License

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-03-24