Debian服务器上重启服务

查进程(最关键一步)

复制代码
ps -ef | grep ChargerServer

如果看到类似:

复制代码
root  12345  1  0 ?  00:01:23 /usr/local/ShelleyLee/NativeAOT/ChargerServer

说明:

✅ 它是手动 / nohup / shell 启动的,不是 systemd

如果什么都没有,那它现在根本没跑。

二、如果当前是"手动运行"的(最常见)

🔁 重启方式(手动)

1️⃣ 停掉进程
复制代码
kill 12345

(不行再来)

复制代码
kill -9 12345

2️⃣ 重新启动

复制代码
cd /usr/local/ShelleyLee/NativeAOT
nohup ./ChargerServer > charger.log 2>&1 &

3️⃣ 验证

复制代码
ps -ef | grep ChargerServer

这种方式不推荐长期使用(服务器重启就没了)

三、强烈推荐:立刻给你转成 systemd 服务(一次到位)

你这个是 云快充 + 长连接 + NativeAOT

👉 systemd 是标准答案

① 创建服务文件

复制代码
sudo nano /etc/systemd/system/chargerserver.service

② 粘贴下面内容(直接可用)

复制代码
[Unit]
Description=Charger Server (Cloud Charge Protocol 1.6)
After=network.target

[Service]
Type=simple
WorkingDirectory=/usr/local/ShelleyLee/NativeAOT
ExecStart=/usr/local/ShelleyLee/NativeAOT/ChargerServer
Restart=always
RestartSec=3
User=root
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target

保存退出(Ctrl + O → 回车 → Ctrl + X)

③ 刷新 systemd

复制代码
sudo systemctl daemon-reload

④ 启动服务

复制代码
sudo systemctl start chargerserver

⑤ 设为开机自启

复制代码
sudo systemctl enable chargerserver

四、现在你就可以正常"重启"了 ✅

复制代码
sudo systemctl restart chargerserver

查看状态:

复制代码
sudo systemctl status chargerserver

看实时日志(调云快充必备):

复制代码
journalctl -u chargerserver -f

五、如果启动失败(快速排雷)

1️⃣ 文件是否可执行

复制代码
ls -l /usr/local/ShelleyLee/NativeAOT/ChargerServer

没有 x 权限就:

复制代码
chmod +x /usr/local/ShelleyLee/NativeAOT/ChargerServer
相关推荐
阿星_7 分钟前
Linux Ubuntu 查看 SQLite 工具
linux·ubuntu·sqlite
Lsetea40 分钟前
OpenSSL的checkhost显示不匹配却退出0:名称检查与证书验收
linux·https·shell·ssl证书·openssl
张文君1 小时前
Ubuntu iSCSI CHAP认证与Win11挂载
linux·运维·ubuntu
一直C1 小时前
嵌入式 Linux 驱动开发学习笔记:中断、等待队列与工作队列
linux·驱动开发·嵌入式硬件·学习·imx6ull
程序员-Benothing1 小时前
Linux防火墙配置教程:iptables、firewalld、nftables、ufw
linux·运维·服务器
齐鲁大虾1 小时前
如何通过 CUPS Web 界面(http://localhost:631)安装打印机驱动
linux
yunwei371 小时前
eBPF 实例教程:使用内核跟踪点监控 GPU 驱动活动
linux·后端·性能优化
AlfredZhao2 小时前
用脚本按顺序执行初始化 DB 的 SQL 文件
linux
瑞克-桑切斯3 小时前
企业生产环境:https部署+nginx高可用(业务不中断)
linux·服务器·数据库
浩浩测试一下10 小时前
Linux 底层知识点 1
linux·运维·服务器