Update portmaster-start to create pid-lock file for notifier

This commit is contained in:
Patrick Pacher
2021-05-04 09:37:47 +02:00
parent 0c2ff73f71
commit fe29293474
2 changed files with 14 additions and 7 deletions

View File

@@ -13,8 +13,9 @@ import (
processInfo "github.com/shirou/gopsutil/process"
)
func checkAndCreateInstanceLock(name string) (pid int32, err error) {
lockFilePath := filepath.Join(dataRoot.Path, fmt.Sprintf("%s-lock.pid", name))
func checkAndCreateInstanceLock(path, name string) (pid int32, err error) {
lockFilePath := filepath.Join(dataRoot.Path, path, fmt.Sprintf("%s-lock.pid", name))
// read current pid file
data, err := ioutil.ReadFile(lockFilePath)
@@ -93,7 +94,7 @@ func createInstanceLock(lockFilePath string) error {
return nil
}
func deleteInstanceLock(name string) error {
lockFilePath := filepath.Join(dataRoot.Path, fmt.Sprintf("%s-lock.pid", name))
func deleteInstanceLock(path, name string) error {
lockFilePath := filepath.Join(dataRoot.Path, path, fmt.Sprintf("%s-lock.pid", name))
return os.Remove(lockFilePath)
}