Skip to content

Commit

Permalink
fix log file on k8s issue
Browse files Browse the repository at this point in the history
(cherry picked from commit 6f2800f)
  • Loading branch information
yabinma authored and abhishek9686 committed May 30, 2024
1 parent 61f95d7 commit b085609
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion daemon/openrc_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import (
"golang.org/x/exp/slog"
)

var (
LogFile = "/var/log/netclient.log"
)

// setupOpenRC - sets up openrc daemon
func setupOpenRC() error {
service := `#!/sbin/openrc-run
Expand All @@ -25,7 +29,6 @@ respawn_period=10
output_log="/var/log/netclient.log"
error_log="/var/log/netclient.log"
depend() {
need net
after firewall
}
Expand All @@ -34,6 +37,13 @@ depend() {
if err := os.WriteFile("/etc/init.d/netclient", bytes, 0755); err != nil {
return err
}
if _, err := os.Stat(LogFile); err != nil {
if os.IsNotExist(err) {
if err := os.WriteFile(LogFile, []byte("--------------------"), 0644); err != nil {
return err
}
}
}
if _, err := ncutils.RunCmd("/sbin/rc-update add netclient default", false); err != nil {
return err
}
Expand Down

0 comments on commit b085609

Please sign in to comment.