Add commands to start and stop winbind, thanks to Caspar Smit
authorJamie Cameron <jcameron@webmin.com>
Tue, 31 May 2011 21:14:50 +0000 (14:14 -0700)
committerJamie Cameron <jcameron@webmin.com>
Tue, 31 May 2011 21:14:50 +0000 (14:14 -0700)
samba/restart_wb.cgi [new file with mode: 0755]
samba/start_wb.cgi [new file with mode: 0755]
samba/stop_wb.cgi [new file with mode: 0755]

diff --git a/samba/restart_wb.cgi b/samba/restart_wb.cgi
new file mode 100755 (executable)
index 0000000..32c8839
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/local/bin/perl
+# Kill all winbindd processes and re-start them
+
+require './samba-lib.pl';
+
+&error_setup("<blink><font color=red>$text{'eacl_aviol'}</font></blink>");
+&error("$text{'eacl_np'} $text{'eacl_papply'}") unless $access{'apply'};
+
+&error_setup($text{'restart_err_wb'});
+if ($config{'stop_cmd_wb'}) {
+       &system_logged("$config{'stop_cmd_wb'} >/dev/null 2>&1 </dev/null");
+       }
+else {
+       @wbpids = &find_byname("winbindd");
+       &kill_logged('TERM', @wbpids);
+       }
+
+if ($config{'start_cmd_wb'}) {
+       $rv = &system_logged("$config{'start_cmd_wb'} >/dev/null 2>&1 </dev/null");
+       if ($rv) { &error(&text('start_fail', $config{'start_cmd_wb'})); }
+       }
+else {
+       $rv = &system_logged("$config{winbind_server} >/dev/null 2>&1 </dev/null");
+       if ($rv) { &error(&text('start_fail', $config{winbind_server})); }
+       }
+
+&webmin_log("apply_wb");
+&redirect("");
+
diff --git a/samba/start_wb.cgi b/samba/start_wb.cgi
new file mode 100755 (executable)
index 0000000..0a6fd1c
--- /dev/null
@@ -0,0 +1,22 @@
+#!/usr/local/bin/perl
+# Attempt to start the winbindd processes
+
+require './samba-lib.pl';
+
+&error_setup("<blink><font color=red>$text{'eacl_aviol'}</font></blink>");
+&error("$text{'eacl_np'} $text{'eacl_papply'}") unless $access{'apply'};
+&error_setup($text{'start_err_wb'});
+
+if ($config{'start_cmd_wb'}) {
+       $rv = &system_logged("$config{'start_cmd_wb'} >/dev/null 2>&1 </dev/null");
+       if ($rv) { &error(&text('start_fail', $config{'start_cmd_wb'})); }
+       }
+else {
+       chdir("/");
+       $rv = &system_logged("$config{winbind_server} </dev/null");
+       if ($rv) { &error(&text('start_fail', $config{winbind_server})); }
+       }
+&webmin_log("start_wb");
+&redirect("");
+
diff --git a/samba/stop_wb.cgi b/samba/stop_wb.cgi
new file mode 100755 (executable)
index 0000000..bb5f7cd
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/local/bin/perl
+# Kill all winbindd processes
+
+require './samba-lib.pl';
+
+&error_setup("<blink><font color=red>$text{'eacl_aviol'}</font></blink>");
+&error("$text{'eacl_np'} $text{'eacl_papply'}") unless $access{'apply'};
+if ($config{'stop_cmd_wb'}) {
+       &system_logged("$config{'stop_cmd_wb'} >/dev/null 2>&1 </dev/null");
+       }
+else {
+       @wbpids = &find_byname("winbindd");
+       &kill_logged('TERM', @wbpids);
+       }
+
+&webmin_log("stop_wb");
+&redirect("");
+