typo deamon->daemon
This commit is contained in:
parent
588af5143f
commit
4f81692954
2
.github/workflows/go.yml
vendored
2
.github/workflows/go.yml
vendored
@ -39,7 +39,7 @@ jobs:
|
|||||||
fileboy init
|
fileboy init
|
||||||
cat filegirl.yaml
|
cat filegirl.yaml
|
||||||
fileboy exec
|
fileboy exec
|
||||||
fileboy deamon
|
fileboy daemon
|
||||||
ls -al .fileboy.pid
|
ls -al .fileboy.pid
|
||||||
ps aux | grep fileboy
|
ps aux | grep fileboy
|
||||||
fileboy stop
|
fileboy stop
|
||||||
|
@ -20,7 +20,7 @@ script:
|
|||||||
- fileboy init
|
- fileboy init
|
||||||
- cat filegirl.yaml
|
- cat filegirl.yaml
|
||||||
- fileboy exec
|
- fileboy exec
|
||||||
- fileboy deamon
|
- fileboy daemon
|
||||||
- ls -al .fileboy.pid
|
- ls -al .fileboy.pid
|
||||||
- ps aux | grep fileboy
|
- ps aux | grep fileboy
|
||||||
- fileboy stop
|
- fileboy stop
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
### Release v1.15
|
### Release v1.15
|
||||||
|
|
||||||
|
2020.03.16
|
||||||
|
|
||||||
|
- typo deamon->daemon
|
||||||
|
|
||||||
2020.03.08
|
2020.03.08
|
||||||
|
|
||||||
- 优化 指令模式
|
- 优化 指令模式
|
||||||
|
18
deamon.go
18
deamon.go
@ -12,11 +12,11 @@ func getPidFile() string {
|
|||||||
return projectFolder + "/.fileboy.pid"
|
return projectFolder + "/.fileboy.pid"
|
||||||
}
|
}
|
||||||
|
|
||||||
func runAsDeamon() (int, error) {
|
func runAsDaemon() (int, error) {
|
||||||
if runtime.GOOS == "windows" {
|
if runtime.GOOS == "windows" {
|
||||||
logAndExit("daemons mode cannot run on windows.")
|
logAndExit("daemons mode cannot run on windows.")
|
||||||
}
|
}
|
||||||
err := stopDeamon()
|
err := stopDaemon()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logAndExit(err)
|
logAndExit(err)
|
||||||
}
|
}
|
||||||
@ -24,22 +24,22 @@ func runAsDeamon() (int, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
logAndExit("cannot found `fileboy` command in the PATH")
|
logAndExit("cannot found `fileboy` command in the PATH")
|
||||||
}
|
}
|
||||||
deamon := exec.Command("fileboy")
|
daemon := exec.Command("fileboy")
|
||||||
deamon.Dir = projectFolder
|
daemon.Dir = projectFolder
|
||||||
deamon.Env = os.Environ()
|
daemon.Env = os.Environ()
|
||||||
deamon.Stdout = os.Stdout
|
daemon.Stdout = os.Stdout
|
||||||
err = deamon.Start()
|
err = daemon.Start()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logAndExit(err)
|
logAndExit(err)
|
||||||
}
|
}
|
||||||
pid := deamon.Process.Pid
|
pid := daemon.Process.Pid
|
||||||
if pid != 0 {
|
if pid != 0 {
|
||||||
ioutil.WriteFile(getPidFile(), []byte(strconv.Itoa(pid)), 0644)
|
ioutil.WriteFile(getPidFile(), []byte(strconv.Itoa(pid)), 0644)
|
||||||
}
|
}
|
||||||
return pid, nil
|
return pid, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func stopDeamon() error {
|
func stopDaemon() error {
|
||||||
bs, err := ioutil.ReadFile(getPidFile())
|
bs, err := ioutil.ReadFile(getPidFile())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
|
@ -265,8 +265,8 @@ func parseArgs() {
|
|||||||
case len(os.Args) > 1:
|
case len(os.Args) > 1:
|
||||||
c := os.Args[1]
|
c := os.Args[1]
|
||||||
switch c {
|
switch c {
|
||||||
case "deamon":
|
case "deamon", "daemon":
|
||||||
pid, err := runAsDeamon()
|
pid, err := runAsDaemon()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logAndExit(err)
|
logAndExit(err)
|
||||||
}
|
}
|
||||||
@ -274,7 +274,7 @@ func parseArgs() {
|
|||||||
logUInfo("fileboy is ready. the main process will run as a daemons")
|
logUInfo("fileboy is ready. the main process will run as a daemons")
|
||||||
return
|
return
|
||||||
case "stop":
|
case "stop":
|
||||||
err := stopDeamon()
|
err := stopDaemon()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logAndExit(err)
|
logAndExit(err)
|
||||||
}
|
}
|
||||||
|
2
raw.go
2
raw.go
@ -112,7 +112,7 @@ Usage of fileboy:
|
|||||||
初始化 fileboy, 在当前目录生成 filegirl.yaml 配置文件
|
初始化 fileboy, 在当前目录生成 filegirl.yaml 配置文件
|
||||||
exec
|
exec
|
||||||
尝试运行定义的 command 命令
|
尝试运行定义的 command 命令
|
||||||
deamon
|
daemon
|
||||||
读取当前目录下的 filegirl.yaml 配置,以守护进程的方式运行在后台
|
读取当前目录下的 filegirl.yaml 配置,以守护进程的方式运行在后台
|
||||||
stop
|
stop
|
||||||
停止守护进程
|
停止守护进程
|
||||||
|
Loading…
Reference in New Issue
Block a user