diff --git a/backend/networking/shutdown.go b/backend/networking/shutdown.go index 793e487d..15b71c57 100644 --- a/backend/networking/shutdown.go +++ b/backend/networking/shutdown.go @@ -6,6 +6,7 @@ import ( "fmt" "os/exec" "runtime" + "strings" "time" "github.com/pocketbase/pocketbase/core" @@ -29,6 +30,9 @@ func ShutdownDevice(device *core.Record) error { shell_arg = "-c" } + shutdown_cmd = strings.ReplaceAll(shutdown_cmd, "{{ DEVICE_IP }}", device.GetString("ip")) + shutdown_cmd = strings.ReplaceAll(shutdown_cmd, "{{ DEVICE_MAC }}", device.GetString("mac")) + ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel() diff --git a/backend/networking/wake.go b/backend/networking/wake.go index 573a96d5..d573ef14 100644 --- a/backend/networking/wake.go +++ b/backend/networking/wake.go @@ -6,6 +6,7 @@ import ( "fmt" "os/exec" "runtime" + "strings" "time" "github.com/pocketbase/pocketbase/core" @@ -32,6 +33,9 @@ func WakeDevice(device *core.Record) error { shell_arg = "-c" } + wake_cmd = strings.ReplaceAll(wake_cmd, "{{ DEVICE_IP }}", device.GetString("ip")) + wake_cmd = strings.ReplaceAll(wake_cmd, "{{ DEVICE_MAC }}", device.GetString("mac")) + ctx := context.Background() ctx, cancel := context.WithCancel(ctx) defer cancel()