typo deamon->daemon

master
dengsgo 2020-03-16 11:16:14 +08:00
parent 588af5143f
commit 4f81692954
6 changed files with 19 additions and 15 deletions

View File

@ -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

View File

@ -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

View File

@ -1,5 +1,9 @@
### Release v1.15 ### Release v1.15
2020.03.16
- typo deamon->daemon
2020.03.08 2020.03.08
- 优化 指令模式 - 优化 指令模式

View File

@ -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

View File

@ -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
View File

@ -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