基于配置的进程管理器。Goforever 可以替代 supervisor, runit, node-forever 等 Goforever 会在指定端口开启一个http服务
Usage of ./goforever:
-conf="goforever.toml": Path to config file.
ip = "127.0.0.1" # API 监听地址
port = "2224" # API 监听端口
username = "go" # API 用户名
password = "forever" # API 密码
pidfile = "goforever.pid"
logfile = "goforever.log"
errfile = "goforever.log"
[[process]]
name = "example-panic"
command = "./example/example-panic"
pidfile = "example/example-panic.pid"
logfile = "example/logs/example-panic.debug.log"
errfile = "example/logs/example-panic.errors.log"
respawn = 1 # 进程被结束时自动重启
delay = "1m" # 延迟一分钟启动
ping = "30s" # 30s检测一次进状态
[[process]]
name = "example"
dir = "/tmp/" # 切换到此目录下运行 command
env = ["aaa=aaa","bbb=bbb"] # 程序指定的环境变量
command = "./example/example"
args = ["-name=foo"] # 命令行参数
pidfile = "example/example.pid"
logfile = "example/logs/example.debug.log"
errfile = "example/logs/example.errors.log"
respawn = 1
Help.
./goforever -h
Daemonize main process.
./goforever start
Run main process and output to current session.
./goforever
list List processes.
show [process] Show a main proccess or named process.
start [process] Start a main proccess or named process.
stop [process] Stop a main proccess or named process.
restart [process] Restart a main proccess or named process.
Return a list of managed processes
GET host:port/
Start the process
POST host:port/:name
Restart the process
PUT host:port/:name
Stop the process
DELETE host:port/:name