1Panel/backend/app/service
巴山夜语 79020abb1c
feat(systemctl): implement service manager initialization and command execution (#8380)
* feat(systemctl): 实现服务管理器初始化和命令执行

- 新增 systemctl 包,实现对 systemd、openrc 和 sysvinit 三种服务管理器的支持
- 添加服务状态检查、启动、停止、重启和启用/禁用功能
- 实现服务发现和智能服务名处理
- 添加配置文件查看功能
- 优化错误处理和日志记录

* refactor(system): 重构系统服务管理逻辑

- 引入 systemctl 工具包以统一处理系统服务
- 优化服务状态获取、配置文件路径解析等逻辑
- 重构 HostToolService 中的 GetToolStatus 方法
- 更新 DockerService、SettingService 等相关服务的处理方式
- 调整快照创建和恢复过程中的服务处理逻辑

* feat(utils): 添加目录复制功能并优化文件复制逻辑

- 新增 CopyDirs 函数,用于复制整个目录及其内容
- 添加对符号链接的复制支持
- 实现通用的 Copy 函数,根据文件类型自动选择 CopyFile 或 CopyDirs
- 在 CopyFile 函数中增加对源文件是目录的检查和错误提示

* refactortoolbox: 重构 Fail2ban 和 Pure-FTPd 的管理逻辑

- 优化了 Fail2ban 和 Pure-FTPd 的启动、停止、重启等操作的实现
- 改进了 Fail2ban 版本信息的获取方法
- 统一了错误处理和日志记录的格式
- 调整了部分导入的包,提高了代码的可维护性

* build: 禁用 CGO 以提高构建性能和兼容性

- 在 Linux 后端构建命令中添加 CGO_ENABLED=0 环境变量
- 此修改可以提高构建速度,并确保生成的二进制文件在没有 C 库依赖的环境中也能运行

* refactor(docker): 重构 Docker 服务的重启和操作逻辑

- 添加 isDockerSnapInstalled 函数来判断 Docker 是否通过 Snap 安装
- 在 OperateDocker 和 restartDocker 函数中增加对 Snap 安装的处理
- 移除未使用的 getDockerRestartCommand 函数

* fix(service): 优化快照恢复后的服务重启逻辑

- 在使用 systemd 管理服务时,增加 daemon-reload 操作以确保服务配置更新
- 重启 1panel 服务,以应用快照恢复的更改

* refactor(server): 支持非 systemd 系统的恢复操作

- 增加 isSystemd 函数判断系统是否为 systemd 类型
- 根据系统类型选择性地恢复服务文件
- 兼容 systemd 和非 systemd 系统的恢复流程

* fix(upgrade): 优化升级过程中的服务重启逻辑

- 移动服务重启逻辑到版本号更新之后,修复因提前重启导致的版本号未更新BUG。
- 在 systemctl 重启之前添加 daemon-reload 命令

---------

Co-authored-by: gcsong023 <gcsong023@users.noreply.github.com>
2025-04-17 10:26:13 +08:00
..
ai.go feat: Add certificate validation when creating AI Proxy (#7994) 2025-02-25 15:21:16 +08:00
app.go feat: Adding GPU acceleration configuration to some applications (#7865) 2025-02-13 07:02:08 +00:00
app_install.go fix: Optimize database password verification and password change (#8294) 2025-04-02 16:03:44 +08:00
app_utils.go feat: Added partial prompt messages (#7900) 2025-02-18 10:08:52 +00:00
auth.go feat: support load ollama model details (#7867) 2025-02-13 14:56:24 +00:00
backup.go feat: Support for asynchronously obtaining the backup file size (#7660) 2025-01-07 06:35:33 +00:00
backup_app.go feat: 应用升级备份保留 3 份 (#6116) 2024-08-13 07:28:55 +00:00
backup_mysql.go fix: Fix the issue of loading errors for editing container port data (#7945) 2025-02-21 04:01:49 +00:00
backup_postgresql.go fix: Fix the issue of loading errors for editing container port data (#7945) 2025-02-21 04:01:49 +00:00
backup_redis.go style:fit some code style (#5601) 2024-06-28 14:04:08 +08:00
backup_runtime.go style:fit some code style (#5601) 2024-06-28 14:04:08 +08:00
backup_website.go feat: 增加 Go 运行环境 (#5632) 2024-07-01 18:35:15 +08:00
clam.go feat(systemctl): implement service manager initialization and command execution (#8380) 2025-04-17 10:26:13 +08:00
command.go fix: Redis 数据库连接信息移除密码限制 (#5239) 2024-05-31 09:35:20 +00:00
compose_template.go feat: 表格增加搜索框 2023-02-08 14:18:25 +08:00
container.go fix: Fixed an update failure when the container network is bridge (#8290) 2025-04-02 03:37:53 +00:00
container_compose.go fix: 解决容器编排路径为空时无法删除的问题 (#6862) 2024-10-27 15:18:02 +00:00
container_network.go pref: 释放容器 client 连接 (#4700) 2024-04-25 08:45:12 +00:00
container_volume.go fix: 统一时区获取方法 (#6175) 2024-08-19 10:30:42 +00:00
cronjob.go fix: Modify database verification rules (#8342) 2025-04-08 02:39:52 +00:00
cronjob_backup.go fix: 解决快照列表排序的问题 (#6816) 2024-10-23 02:46:17 +00:00
cronjob_helper.go fix: Fix the problem of failed MySQL permission modification (#8351) 2025-04-08 10:49:53 +00:00
dashboard.go feat: Support Ollama model management (#7866) 2025-02-13 15:28:29 +08:00
database.go style:fit some code style (#5601) 2024-06-28 14:04:08 +08:00
database_common.go fix: Fix the loading method of slow logs in MySQL and MariaDB (#7915) 2025-02-19 09:48:36 +00:00
database_mysql.go fix: mysql 绑定用户增加输入校验 (#6149) 2024-08-16 06:00:31 +00:00
database_postgresql.go fix: 解决 MariaDB 数据库同步失败的问题 (#5605) 2024-06-28 07:30:59 +00:00
database_redis.go fix: 处理数据库遮罩问题 (#5215) 2024-05-30 15:13:21 +08:00
device.go feat(systemctl): implement service manager initialization and command execution (#8380) 2025-04-17 10:26:13 +08:00
device_clean.go feat(systemctl): implement service manager initialization and command execution (#8380) 2025-04-17 10:26:13 +08:00
docker.go feat(systemctl): implement service manager initialization and command execution (#8380) 2025-04-17 10:26:13 +08:00
entry.go feat: Add MCP management (#8299) 2025-04-02 09:01:54 +00:00
fail2ban.go fix: 解决 Fail2ban 禁用方式切换失败的问题 (#3704) 2024-01-25 18:18:47 +08:00
favorite.go feat: 文件增加收藏夹功能 (#2612) 2023-10-20 09:56:46 +00:00
file.go fix: Fix the loading method of slow logs in MySQL and MariaDB (#7915) 2025-02-19 09:48:36 +00:00
firewall.go fix(forward): Fix the problem of duplicate creation of port forwardin… (#7975) 2025-02-24 09:21:14 +00:00
ftp.go perf: Optimize FTP sync function for better performance and readability (#7479) 2024-12-20 15:45:05 +08:00
group.go fix: 快速命令增加分组 (#2732) 2023-10-31 06:14:30 +00:00
helper.go feat: 修改校验 2022-12-26 16:15:50 +08:00
host.go fix: 解决主机默认分组失败的问题 (#2839) 2023-11-07 15:41:28 +00:00
host_tool.go feat(systemctl): implement service manager initialization and command execution (#8380) 2025-04-17 10:26:13 +08:00
image.go fix: Optimize image deletion error return (#7602) 2024-12-30 09:17:49 +00:00
image_repo.go fix: 解决容器镜像仓库编辑失败的问题 (#6845) 2024-10-25 14:11:55 +00:00
logs.go feat: Optimize Location Information Display in System Login Logs (#7459) 2024-12-20 04:16:25 +00:00
mcp_server.go feat: update mcp proxy_pass (#8374) 2025-04-10 16:45:24 +08:00
monitor.go refactor: 调整主机监控任务时间为整分钟执行 (#6379) 2024-09-05 08:41:48 +00:00
nginx.go pref: 释放容器 client 连接 (#4700) 2024-04-25 08:45:12 +00:00
nginx_utils.go feat: Nginx 配置支持 Lua 模块 (#3844) 2024-02-06 06:02:12 +00:00
php_extensions.go fix: 解决 PHP 模版添加失败的问题 (#3541) 2024-01-09 07:57:34 +00:00
process.go feat: 增加进程管理 (#1476) 2023-06-28 06:50:10 +00:00
recycle_bin.go fix: 解决回收站文件放置错误问题 (#4203) 2024-03-15 08:40:07 +00:00
runtime.go feat(runtime): correct typo in variable name (#7172) 2024-11-25 12:05:42 +08:00
runtime_utils.go feat(appstore): Handle Requests After Application Installation (#7206) 2024-11-28 10:42:40 +00:00
setting.go feat(systemctl): implement service manager initialization and command execution (#8380) 2025-04-17 10:26:13 +08:00
snapshot.go feat: basic support riscv64 (#8369) 2025-04-17 10:24:04 +08:00
snapshot_create.go feat(systemctl): implement service manager initialization and command execution (#8380) 2025-04-17 10:26:13 +08:00
snapshot_recover.go feat(systemctl): implement service manager initialization and command execution (#8380) 2025-04-17 10:26:13 +08:00
ssh.go feat(systemctl): implement service manager initialization and command execution (#8380) 2025-04-17 10:26:13 +08:00
upgrade.go feat(systemctl): implement service manager initialization and command execution (#8380) 2025-04-17 10:26:13 +08:00
website.go style: update style for mcp server (#8338) 2025-04-07 11:09:51 +00:00
website_acme_account.go feat: 不同类型 ACME 账号支持使用同一个邮箱 (#3344) 2023-12-15 07:48:09 +00:00
website_ca.go feat(system-security): Support Hot Reloading of System Certificates (#7152) 2024-11-22 09:48:13 +00:00
website_dns_account.go feat: 升级 github.com/go-jose/go-jose/v3 版本到 v3.0.3 (#4121) 2024-03-08 08:14:07 +00:00
website_ssl.go feat: Fix Issue with DNS Account Deletion After Certificate Update Ap… (#7303) 2024-12-10 03:15:38 +00:00
website_utils.go feat: Added streaming transmission configuration (#7875) 2025-02-15 12:59:38 +00:00