| 1234567891011121314151617181920 |
- package util
- import (
- "os"
- "path/filepath"
- )
- func WritePid() {
- pid := os.Getpid()
- file, err := os.OpenFile(filepath.Join(GetRootPath(), "app.pid"), os.O_CREATE|os.O_TRUNC|os.O_WRONLY, 0644)
- if err != nil {
- Errorf("[WritePid] create app.pid find err, err=%v", err)
- return
- }
- _, err = file.Write([]byte(Int642String(int64(pid))))
- if err != nil {
- Errorf("[WritePid] write pid err, err=%v", err)
- return
- }
- }
|