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
|
||||
cat filegirl.yaml
|
||||
fileboy exec
|
||||
fileboy deamon
|
||||
fileboy daemon
|
||||
ls -al .fileboy.pid
|
||||
ps aux | grep fileboy
|
||||
fileboy stop
|
||||
|
@ -20,7 +20,7 @@ script:
|
||||
- fileboy init
|
||||
- cat filegirl.yaml
|
||||
- fileboy exec
|
||||
- fileboy deamon
|
||||
- fileboy daemon
|
||||
- ls -al .fileboy.pid
|
||||
- ps aux | grep fileboy
|
||||
- fileboy stop
|
||||
|
@ -1,5 +1,9 @@
|
||||
### Release v1.15
|
||||
|
||||
2020.03.16
|
||||
|
||||
- typo deamon->daemon
|
||||
|
||||
2020.03.08
|
||||
|
||||
- 优化 指令模式
|
||||
|
18
deamon.go
18
deamon.go
@ -12,11 +12,11 @@ func getPidFile() string {
|
||||
return projectFolder + "/.fileboy.pid"
|
||||
}
|
||||
|
||||
func runAsDeamon() (int, error) {
|
||||
func runAsDaemon() (int, error) {
|
||||
if runtime.GOOS == "windows" {
|
||||
logAndExit("daemons mode cannot run on windows.")
|
||||
}
|
||||
err := stopDeamon()
|
||||
err := stopDaemon()
|
||||
if err != nil {
|
||||
logAndExit(err)
|
||||
}
|
||||
@ -24,22 +24,22 @@ func runAsDeamon() (int, error) {
|
||||
if err != nil {
|
||||
logAndExit("cannot found `fileboy` command in the PATH")
|
||||
}
|
||||
deamon := exec.Command("fileboy")
|
||||
deamon.Dir = projectFolder
|
||||
deamon.Env = os.Environ()
|
||||
deamon.Stdout = os.Stdout
|
||||
err = deamon.Start()
|
||||
daemon := exec.Command("fileboy")
|
||||
daemon.Dir = projectFolder
|
||||
daemon.Env = os.Environ()
|
||||
daemon.Stdout = os.Stdout
|
||||
err = daemon.Start()
|
||||
if err != nil {
|
||||
logAndExit(err)
|
||||
}
|
||||
pid := deamon.Process.Pid
|
||||
pid := daemon.Process.Pid
|
||||
if pid != 0 {
|
||||
ioutil.WriteFile(getPidFile(), []byte(strconv.Itoa(pid)), 0644)
|
||||
}
|
||||
return pid, nil
|
||||
}
|
||||
|
||||
func stopDeamon() error {
|
||||
func stopDaemon() error {
|
||||
bs, err := ioutil.ReadFile(getPidFile())
|
||||
if err != nil {
|
||||
return nil
|
||||
|
@ -265,8 +265,8 @@ func parseArgs() {
|
||||
case len(os.Args) > 1:
|
||||
c := os.Args[1]
|
||||
switch c {
|
||||
case "deamon":
|
||||
pid, err := runAsDeamon()
|
||||
case "deamon", "daemon":
|
||||
pid, err := runAsDaemon()
|
||||
if err != nil {
|
||||
logAndExit(err)
|
||||
}
|
||||
@ -274,7 +274,7 @@ func parseArgs() {
|
||||
logUInfo("fileboy is ready. the main process will run as a daemons")
|
||||
return
|
||||
case "stop":
|
||||
err := stopDeamon()
|
||||
err := stopDaemon()
|
||||
if err != nil {
|
||||
logAndExit(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user