From c063e9ec3e90508e846dd51e22a643c74c02f7c1 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sat, 14 Mar 1998 12:57:58 +0000 Subject: added the ability to start/stop the server from SWAT. I needed to modify the way the pidfile is handled in nmbd and smbd to do this. Jeremy, you may wish to look at what I've done as it probably breaks the Whistle use of pidfiles. In particular I've removed the -f option and instead smbd and nmbd always create a pidfile in the lock directory. (This used to be commit 20bb22d61b986d2036c681fc33db60f2b2b3c1c7) --- source3/web/swat.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 46 insertions(+), 3 deletions(-) (limited to 'source3/web/swat.c') diff --git a/source3/web/swat.c b/source3/web/swat.c index 650740428f..422259a05a 100644 --- a/source3/web/swat.c +++ b/source3/web/swat.c @@ -1,7 +1,7 @@ /* Unix SMB/Netbios implementation. Version 1.9. - html smb.conf editing - prototype only + Samba Web Administration Tool Copyright (C) Andrew Tridgell 1997-1998 This program is free software; you can redistribute it and/or modify @@ -537,8 +537,26 @@ static void status_page(void) pstring fname; FILE *f; + if (cgi_variable("smbd_start")) { + start_smbd(); + } + + if (cgi_variable("smbd_stop")) { + stop_smbd(); + } + + if (cgi_variable("nmbd_start")) { + start_nmbd(); + } + + if (cgi_variable("nmbd_stop")) { + stop_nmbd(); + } + printf("

Server Status

\n"); + printf("
\n"); + pstrcpy(fname,lp_lockdir()); standard_sub_basic(fname); trim_string(fname,"","/"); @@ -553,9 +571,32 @@ static void status_page(void) } - printf("\nSamba version %s\n

",VERSION); + printf("\n"); + + printf("",VERSION); + + fflush(stdout); + if (smbd_running()) { + printf("\n"); + } else { + printf("\n"); + } + + fflush(stdout); + if (nmbd_running()) { + printf("\n"); + } else { + printf("\n"); + } + + printf("
version:%s
smbd:running
smbd:not running
nmbd:running
nmbd:not running
\n"); + fflush(stdout); + - printf("

Active Connections

\n"); + if (geteuid() != 0) + printf("NOTE: You are not logged in as root and won't be able to start/stop the server

\n"); + + printf("

Active Connections

\n"); printf("\n"); printf("\n\n"); @@ -583,6 +624,8 @@ static void status_page(void) printf("
ShareUserGroupPIDClientDate
\n"); fclose(f); + + printf("
\n"); } -- cgit