restart capability

This commit is contained in:
Aliberk Sandıkçı 2023-07-31 14:11:11 +03:00
parent 115a7b6ddc
commit 8b63561bef
Signed by: asandikci
GPG key ID: 25C67A03B5666BC1
3 changed files with 24 additions and 5 deletions

3
.gitignore vendored
View file

@ -78,4 +78,5 @@ dkms.conf
### USER MODIFIED ###
c-daemon/bin/
go-daemon/bin/
go-daemon/bin/
go-daemon/local-ref.sh

View file

@ -28,11 +28,8 @@ func main() {
log.Print("- - - - - - - - - - - - - - -")
log.Print("daemon started")
log.Print(d, err)
// process, err := os.FindProcess(1)
// daemon.SendCommands(process)
for true {
for {
Info()
time.Sleep(10 * time.Second)
}

View file

@ -0,0 +1,21 @@
package service
import (
"log"
"os"
"syscall"
)
func Restart() error {
log.Println("Restart Signal Caught")
// TODO what you want to do before restarting daemon?
self, err := os.Executable()
if err != nil {
return err
}
args := os.Args
env := os.Environ()
return syscall.Exec(self, args, env)
}