added the base which is ai code and this will be tailored (and have been a little) for specifice yejayekhoob.com use case and tested extensively under short period of time
This commit is contained in:
27
bind.go
Normal file
27
bind.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func SwitchBindConfig(source, target string) error {
|
||||
input, err := os.ReadFile(source)
|
||||
if err != nil {
|
||||
return fmt.Errorf("read source config: %w", err)
|
||||
}
|
||||
|
||||
err = os.WriteFile(target, input, 0o644)
|
||||
if err != nil {
|
||||
return fmt.Errorf("write active config: %w", err)
|
||||
}
|
||||
|
||||
cmd := exec.Command("rndc", "reload")
|
||||
err = cmd.Run()
|
||||
if err != nil {
|
||||
return fmt.Errorf("reload bind: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
Reference in New Issue
Block a user