{"id":13699732,"url":"https://github.com/osgochina/swoole-crontab","last_synced_at":"2025-05-04T17:30:55.863Z","repository":{"id":25118724,"uuid":"28540331","full_name":"osgochina/swoole-crontab","owner":"osgochina","description":"基于swoole的定时器程序，支持秒级处理","archived":false,"fork":false,"pushed_at":"2021-01-08T10:21:09.000Z","size":8451,"stargazers_count":974,"open_issues_count":13,"forks_count":299,"subscribers_count":74,"default_branch":"master","last_synced_at":"2025-04-19T05:44:11.593Z","etag":null,"topics":["crontab","swoole","swoole-crontab"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/osgochina.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-27T15:54:00.000Z","updated_at":"2025-04-16T02:57:04.000Z","dependencies_parsed_at":"2022-07-27T05:02:22.022Z","dependency_job_id":null,"html_url":"https://github.com/osgochina/swoole-crontab","commit_stats":null,"previous_names":["osgochina/donkey"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osgochina%2Fswoole-crontab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osgochina%2Fswoole-crontab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osgochina%2Fswoole-crontab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/osgochina%2Fswoole-crontab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/osgochina","download_url":"https://codeload.github.com/osgochina/swoole-crontab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251795409,"owners_count":21645022,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["crontab","swoole","swoole-crontab"],"created_at":"2024-08-02T20:00:42.578Z","updated_at":"2025-05-04T17:30:54.202Z","avatar_url":"https://github.com/osgochina.png","language":"PHP","funding_links":[],"categories":["Cronjobs","定时任务( Crontab )","定时任务 Crontab"],"sub_categories":[],"readme":"Swoole-Crontab(基于Swoole扩展)\n==============\n1.概述\n--------------\n+ 基于swoole的定时器程序，支持秒级处理.\n+ 异步多进程处理。\n+ 完全兼容crontab语法，且支持秒的配置,可使用数组规定好精确操作时间\n+ 单中心-多客户端模式,能够横向扩展\n+ web界面管理,增删改查任务,完整的权限控制.\n+ 请使用swoole扩展1.8.0+\n+ [v0.8版本入口](https://github.com/osgochina/swoole-crontab/tree/v0.8)\n\n2.架构图\n--------------\n![](https://raw.githubusercontent.com/osgochina/swoole-crontab/master/doc/x.png)\n\n3.Crontab配置\n--------------\n介绍一下时间配置\n\n    0   1   2   3   4   5\n    |   |   |   |   |   |\n    |   |   |   |   |   +------ day of week (0 - 6) (Sunday=0)\n    |   |   |   |   +------ month (1 - 12)\n    |   |   |   +-------- day of month (1 - 31)\n    |   |   +---------- hour (0 - 23)\n    |   +------------ min (0 - 59)\n    +-------------- sec (0-59)[可省略，如果没有0位,则最小时间粒度是分钟]\n    \n4.开始使用\n-----------\n1.修改配置\n\n1.1 中心服配置\n    \n    /path/to/src/center/configs/dev/db.php 修改数据库配置\n    进入mysql数据库执行/path/to/doc/crontab.sql 的sql文件\n    src/center/_init.php   修改 PUBLIC_PATH   swoole framework框架所在的路径\n    \n1.2 admin管理后台的配置文件修改\n    \n    src/admin/configs/dev/db.php  修改数据库配置\n    src/admin/configs/dev/service.php  中心服启动时候监听的ip端口,需要跟中心服通讯\n    src/public/index.php  \n        修改 WEBROOT       域名\n        修改 PUBLIC_PATH   swoole framework框架所在的路径\n    \n    \n2.下载swoole framework框架到本地/data/www/public/ [framework](https://github.com/swoole/framework.git)\n\n3.配置nginx,列子如下：\n\n```\nserver {\n    listen       80;\n    server_name  crontab.test.com;\n    \n    root /data/www/wwwroot/swoole-crontab/src/public;\n    \n    index index.php index.html;\n    location / {\n        if (!-e $request_filename) {\n            rewrite ^/(.*)$ /index.php;\n        }\n    }\n    location ~ \\.php$ {\n        fastcgi_pass   127.0.0.1:9000;\n        fastcgi_index  index.php;\n        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;\n        include        fastcgi_params;\n    }\n\n}\n```\n\n4.启动中心服\n\n    /path/to/php /path/to/src/center/center.php  start -d -h 127.0.0.1 -p 8901\n   \n5.启动客户端\n\n    -h 是指中心服地址 -p 中心服端口\n    /path/to/php /path/to/src/agent/agent.php start -d -h 127.0.0.1 -p 8901\n   \n6.web界面访问\n\n\u003e输入nginx配置的地址访问web界面，默认用户名/密码是admin/admin\n\n7.操作步骤\n\n    请按照以上步骤操作,因为admin后台是通过接口连接上中心服来进行管理.所以必须先启动中心服,再打开admin管理后台\n\n\n\n4.使用交流\n-----------\n\n1.后台截图\n\n![](https://raw.githubusercontent.com/osgochina/swoole-crontab/master/doc/demo.png)\n\n2.更加清晰的架构图.感谢@xufei100 \n\n![](https://raw.githubusercontent.com/osgochina/swoole-crontab/master/doc/xufei100.png)\n\n\nQQ群:560807006\n\n5.TODO\n----------\n\n- [ ] 去除nginx依赖\n- [ ] 配置文件统一\n- [ ] 去除swoole framework框架的依赖\n- [ ] restful api接口\n- [ ] 通过命令行管理任务\n- [ ] 无中心服依赖\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosgochina%2Fswoole-crontab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fosgochina%2Fswoole-crontab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fosgochina%2Fswoole-crontab/lists"}