Browse Source

Move the fix of rights for socket and fix his exec

master
Dashie der otter 1 year ago
parent
commit
417f4a10f1
Signed by: Dashie <dashie@sigpipe.me> GPG Key ID: C2D57B325840B755
2 changed files with 9 additions and 5 deletions
  1. 0
    5
      lutrainit/lutractl_sock_linux.go
  2. 9
    0
      lutrainit/sysinit_linux.go

+ 0
- 5
lutrainit/lutractl_sock_linux.go View File

@@ -6,7 +6,6 @@ import (
"fmt"
"github.com/go-clog/clog"
"github.com/valyala/gorpc"
"os"
"runtime"
"time"
)
@@ -99,10 +98,6 @@ func socketInitctl() {
clog.Info("[lutra] RPC starting on socket: %s", GoRPCServer.Addr)
GoRPCStarted = true

if err := os.Chmod("/run/ottersock", 0757); err != nil {
clog.Error(2, "cannot fixe rights on socket: %s", err.Error())
}

if err := GoRPCServer.Serve(); err != nil {
GoRPCStarted = false
clog.Error(2, "[lutra][socket] Starting GoRPC error", err.Error())

+ 9
- 0
lutrainit/sysinit_linux.go View File

@@ -11,6 +11,7 @@ import (
"os/exec"
"strings"
"syscall"
"time"
)

// Runs a command, setting up Stdin/Stdout/Stderr to be the standard OS
@@ -97,6 +98,14 @@ func sysinit(ctx *cli.Context) error {
// Start socket in background
go socketInitctl()

// Wait a bit for the socket to initialize
time.Sleep(500 * time.Millisecond)

// Then fix the rights on the socket
if err := os.Chmod("/run/ottersock", 0757); err != nil {
clog.Error(2, "cannot fix rights on socket: %s", err.Error())
}

if !MainConfig.StartedReexec {
// Mount local filesystems
// This have been moved in a .service file for now

Loading…
Cancel
Save