Koozali.org: home of the SME Server
Obsolete Releases => SME Server 8.x => Topic started by: mikey777 on August 02, 2013, 03:57:20 PM
-
Hi I need to know if there is a way to view active connection to SME 8 server or is there a third party app i can use. I need this because sometimes i need to restart to server and not all user logoff server.
-
in console you can use netstat or lsof
netstat -n -A inet
lsof -i
imaps or imap or pop 3 or ldap are not "so important"
most probably you need to parse them with grep for what are you interested in
to see what your server are listening to
netstat --listen -A inet
-
If your concern is mounted network shares and open files, you might want
smbstatus
-
I need this because sometimes i need to restart to server and not all user logoff server.
You can restart the server whether they logoff or not.
-
I posted some php code to show any samba files open to be accessed by a web browsers.
you can look it up on the forum, search serverstatus or something like that and also here is some php code
<!--DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"-->
<html>
<head><title>Server Status</title></head>
<body>
<tt>
<b>
<div>
<?php
print "<pre>";
echo '<font size="4">';
print "Server Status Report\n";
print "\n";
print "Current date : ";
system("date +'%m-%d-%Y %T %Z' | col -b",$return);
print " URL name : ";
print ($_SERVER['SERVER_NAME']);
print "\n";
print " Server name : ";
system("uname -n | col -b",$return);
print "************** UPTIME ***************\n";
system("uptime | col -b",$return);
print "\n";
print "\n";
print "************** SMB STATUS ****************\n";
system("smbstatus | col -b",$return);
print "\n";
print "\n---end of report---\n";
print "</pre>";
?>
</div>
</body>
</html>
-
here is php code for a web page that loops back to itself
this report will only show files opened using samba file sharing
<!--DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"-->
<html>
<head>
<meta http-equiv="refresh" content="1">
<title>Server open smb files report</title>
</head>
<body>
<tt>
<b>
<div>
<font size="3">
To stop this webpage from automatic refreshing <a href="filesopen.php">click here</a>.
<?php
print "<pre>";
echo '<font size="2">';
print "Server open smb files report ";system("date +'%m-%d-%Y %T %Z' | col -b",$return);
print "URL name : ";
print ($_SERVER['SERVER_NAME']);
system("smbstatus -b | col -b",$return);
echo '<font size="3">';
print "\n";
system("smbstatus -L | col -b",$return);
echo '<font size="2">';
print "---end of report---\n";
print "</pre>";
?>
</div>
</body>
</html>
-
thanks alot smbstatus works perfectly :-o
-
SME 32-bit version of smbstatus discussed ONLY
There is an issue with smbstatus(/usr/bin/smbstatus) not returning text information in php coded webpages after an update in SME 8.
The issue seems to stem from the developers of samba. I am not sure.
Here is link to some discussion
https://bugzilla.samba.org/show_bug.cgi?id=9432
-
I am going to cross reference the previous post to an older post where I original posted the php code.
http://forums.contribs.org/index.php/topic,47424.msg
-
The problem that developed from running the smbstatus from a webpage is in permissions.
I do not have any experience using the sudoers file located in /etc directory.
But I added the below line in the /etc/sudoers file.
apache ALL=(root) NOPASSWD:/usr/bin/smbstatus
The unaltered /etc/sudoers has one line "root ALL=(ALL) ALL"
I created a custom template in the sme server to allow /usr/bin/smbstatus to be run with the sudo command inside of a php webpage
What I did to allow smbstatus to run from the php webpage.
1ST.
---------------
If the directory of /etc/e-smith/templates-custom/etc/sudoers/ does not exist and if there are no files in the directory.
I created the directory and copied the /etc/sudoers file into the directory and renamed it to 10sudoers
Be careful that you are not erasing any files that already exist inside the directory /etc/e-smith/templates-custom/etc/sudoers/
mkdir -p /etc/e-smith/templates-custom/etc/sudoers
cp /etc/sudoers /etc/e-smith/templates-custom/etc/sudoers/10sudoers
2ND
---------------
I created a file named 20smbstatus inside the directory /etc/e-smith/templates-custom/etc/sudoers and pasted the
text "apache ALL=(root) NOPASSWD:/usr/bin/smbstatus" inside of the file. Do not use the double quote marks if you are using a file editor and adding the text in the file.
The command to do this in a one line command without using an editor from the command line is.
echo "apache ALL=(root) NOPASSWD:/usr/bin/smbstatus" > /etc/e-smith/templates-custom/etc/sudoers/20smbstatus
3RD and final step
---------------
Finish the setup
expand-template /etc/sudoers
you should now see the added text in the /etc/sudoers file
cat /etc/sudoers
4TH
If reboot is required
signal-event post-upgrade;signal-event reboot
-
After the above steps.
I changed the lines in my php webpages that run the smbstatus program using the php command "system" to run under root privileges using the linux sudo command.
There are other lines where i use smbstatus but here is an example of a single line in php code that works now, as opposed to where it did work after updating SME 8.
from
system("smbstatus -b | col -b",$return);
to
system("sudo /usr/bin/smbstatus -b | col -b",$return);
This works for the smbstatus version 3.6.6-0.136.el5.
You can use the command "smbstatus -V" to retrieve the version number.
This is working on one 64 bit SME operating system and a 32 bit SME operating system version 8.