mirror of https://github.com/shunfei/cronsun
parent
5279e15dff
commit
b2585afc11
|
@ -2,6 +2,7 @@ package conf
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
|
@ -178,12 +179,12 @@ func (c *Conf) genUUID() (string, error) {
|
||||||
|
|
||||||
uuidDir := path.Dir(c.UUIDFile)
|
uuidDir := path.Dir(c.UUIDFile)
|
||||||
if err := os.MkdirAll(uuidDir, 0755); err != nil {
|
if err := os.MkdirAll(uuidDir, 0755); err != nil {
|
||||||
return "", err
|
return "", fmt.Errorf("failed to write UUID to file: %s. you can change UUIDFile config in base.json", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ioutil.WriteFile(c.UUIDFile, []byte(u.String()), 0600)
|
err = ioutil.WriteFile(c.UUIDFile, []byte(u.String()), 0600)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", fmt.Errorf("failed to write UUID to file: %s. you can change UUIDFile config in base.json", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return u.String(), nil
|
return u.String(), nil
|
||||||
|
|
|
@ -121,14 +121,14 @@ func (n *Node) writePIDFile() {
|
||||||
dir := path.Dir(n.PIDFile)
|
dir := path.Dir(n.PIDFile)
|
||||||
err := os.MkdirAll(dir, 0755)
|
err := os.MkdirAll(dir, 0755)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Failed to write pid file: %s", err)
|
log.Errorf("Failed to write pid file: %s. you can change PIDFile config in base.json", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
n.PIDFile = path.Join(dir, filename)
|
n.PIDFile = path.Join(dir, filename)
|
||||||
err = ioutil.WriteFile(n.PIDFile, []byte(n.PID), 0644)
|
err = ioutil.WriteFile(n.PIDFile, []byte(n.PID), 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("Failed to write pid file: %s", err)
|
log.Errorf("Failed to write pid file: %s. you can change PIDFile config in base.json", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue