Files
auto_cursor/START_README.md
huangzhenpc 6dad187156 xx
2025-04-01 17:58:08 +08:00

2.3 KiB
Raw Permalink Blame History

Cursor自动化服务统一启动脚本

这个统一启动脚本(start.py用于集中管理Cursor注册的各项功能包括注册状态检查、账号上传和自动化服务。

功能特点

  1. 集中管理

    • 通过数据库标记控制自动服务的启停
    • 提供统一的命令行接口管理各项功能
  2. 灵活操作

    • 可以单独启动注册进程
    • 可以执行单次账号上传
    • 可以管理自动化服务的状态
  3. 简化部署

    • 无需手动启动多个脚本
    • 支持作为服务自动启动

使用方法

基本用法

不带参数启动时,脚本会检查数据库中的启动标记,并据此启动或停止自动服务:

python start.py

启用自动服务

设置启动标记并启动自动服务:

python start.py --enable

禁用自动服务

清除启动标记并停止自动服务:

python start.py --disable

查看服务状态

查看当前自动服务的状态:

python start.py --status

手动上传账号

执行一次账号上传操作,不影响自动服务:

python start.py --upload

仅运行注册进程

直接启动注册进程,不启动完整的自动服务:

python start.py --register

工作原理

  1. 脚本使用数据库中的system_settings表存储自动服务的启用状态
  2. 当状态为启用时,脚本会自动启动auto_cursor_service.py
  3. 自动服务会负责检查API状态、获取邮箱和上传账号等操作
  4. 如果只需单独功能,可以使用相应的命令行参数

设置为系统服务

Linux (systemd)

创建服务文件/etc/systemd/system/cursor-service.service

[Unit]
Description=Cursor Auto Registration Service
After=network.target mysql.service redis.service

[Service]
Type=simple
User=your_user
WorkingDirectory=/path/to/cursor/app
ExecStart=/usr/bin/python3 /path/to/cursor/app/start.py
Restart=on-failure
RestartSec=10

[Install]
WantedBy=multi-user.target

启动服务:

sudo systemctl daemon-reload
sudo systemctl start cursor-service
sudo systemctl enable cursor-service

Windows (开机自启)

创建批处理文件start_cursor.bat

@echo off
cd /d "C:\path\to\cursor\app"
python start.py

将此批处理文件添加到启动文件夹。