mirror of https://github.com/shunfei/cronsun
parent
5279e15dff
commit
b2585afc11
|
@ -2,6 +2,7 @@ package conf
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
|
@ -178,12 +179,12 @@ func (c *Conf) genUUID() (string, error) {
|
|||
|
||||
uuidDir := path.Dir(c.UUIDFile)
|
||||
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)
|
||||
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
|
||||
|
|
|
@ -121,14 +121,14 @@ func (n *Node) writePIDFile() {
|
|||
dir := path.Dir(n.PIDFile)
|
||||
err := os.MkdirAll(dir, 0755)
|
||||
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
|
||||
}
|
||||
|
||||
n.PIDFile = path.Join(dir, filename)
|
||||
err = ioutil.WriteFile(n.PIDFile, []byte(n.PID), 0644)
|
||||
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
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue