Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/rfyiamcool/go-fcntl-pid

golang fcntl pid
https://github.com/rfyiamcool/go-fcntl-pid

fcntl golang pid

Last synced: 2 months ago
JSON representation

golang fcntl pid

Awesome Lists containing this project

README

        

# go-fcntl-pid

use syscall.flock() to write pid file, avoid concurrently start to cause bug concurrently .

## example:

```
package main

import (
"fmt"
"time"

"github.com/rfyiamcool/go-fcntl-pid"
)

func pp() {
for {
time.Sleep(1 * time.Second)
fmt.Println("trigger keepalive")
}
}

func main() {
filename := "mm.pid"
pidfile.CheckExit(filename)
pp()
}
```