Files
termi-blog/backend/content/posts/linux-shell.md
limitcool 92a85eef20 feat: Refactor service management scripts to use a unified dev script
- Added package.json to manage development scripts.
- Updated restart-services.ps1 to call the new dev script for starting services.
- Refactored start-admin.ps1, start-backend.ps1, start-frontend.ps1, and start-mcp.ps1 to utilize the dev script for starting respective services.
- Enhanced stop-services.ps1 to improve process termination logic by matching command patterns.
2026-03-29 21:36:13 +08:00

591 B

title, description, date, draft, Hidden, slug, image, categories, tag
title description date draft Hidden slug image categories tag
Linux Shell 2022-05-21T10:02:09+08:00 false true linux-shell Linux Linux Shell

Linux守护进程🙅

#!/bin/bash
# nohup.sh
while true
do 
    # -f 后跟进程名,判断进程是否正在运行
    if [ `pgrep -f <ProcessName> | wc -l` -eq 0 ];then
        echo "进程已终止"
        push
        # /dev/null 无输出日志
        nohup ./<ProcessName> > /dev/null 2>&1 &
    else
        echo "进程正在运行"
    fi
    # 每隔1分钟检查一次
    sleep 1m
done