refactored delete, pull nil pointer and logging

This commit is contained in:
0xdcarns
2022-02-08 10:43:46 -05:00
parent a85a888251
commit 39cea2da6c
8 changed files with 57 additions and 27 deletions

View File

@@ -74,12 +74,14 @@ WantedBy=multi-user.target
return nil
}
// RestartSystemD - restarts systemd service
func RestartSystemD() {
ncutils.PrintLog("restarting netclient.service", 1)
time.Sleep(time.Second)
_, _ = ncutils.RunCmd("systemctl restart netclient.service", true)
}
// CleanupLinux - cleans up neclient configs
func CleanupLinux() {
if err := os.RemoveAll(ncutils.GetNetclientPath()); err != nil {
ncutils.PrintLog("Removing netclient configs: "+err.Error(), 1)
@@ -89,6 +91,11 @@ func CleanupLinux() {
}
}
// StopSystemD - tells system to stop systemd
func StopSystemD() {
ncutils.RunCmd("systemctl stop netclient.service", false)
}
// RemoveSystemDServices - removes the systemd services on a machine
func RemoveSystemDServices() error {
//sysExec, err := exec.LookPath("systemctl")