Sambastatus: my first module for nethserver

module

(Enrique D) #81

Ops! I wasn’t thinking and do those modifications…
but, that changes aren’t for me, right?

Because I see machines listed in /var/lib/nethserver/home


(Markus Neuberger) #82

Yes but maybe I have a problem because my machines are not listed in /var/lib/nethserver/home. I use local AD provider and login from my Windows machines is working. Do you use linux clients or remote AD?


(Enrique D) #83

Using local AD (avion.lan), some Windows computers joined and logged.
Mine is a virtualbox windows 8.
Some other are real hardware that are logged just one is using the shared folders.

I’m working on this NethServer AD (inside proxmox) is prepared to replace a really old Windows 2000 SBS PDC.
Something that I’m notice right now, the folder shows even computers that aren’t joined to this domain (avion.lan), those computers still are joined in the old one (avion.local)
:upside_down_face::thinking:

EDIT1:
If I edit the script Joined.php; I need to do something for this to work or is used instantly after being edited?

EDIT2:
If I run the php script from the terminal, I got this error:

php /usr/share/nethesis/NethServer/Template/SambaStatus/Joined.php

PHP Notice: Undefined variable: view in /usr/share/nethesis/NethServer/Template/SambaStatus/Joined.php on line 2
PHP Fatal error: Call to a member function header() on a non-object in /usr/share/nethesis/NethServer/Template/SambaStatus/Joined.php on line 2


(Markus Neuberger) #84

It’s working instantly but it does not solve your “Share” problem, it’s just for the joined computers.

It’s for running a browser and not for running in terminal.


(Enrique D) #85

Right! :upside_down_face:

Now I understand a little more, inside “/usr/share/nethesis/NethServer/Template/” are located the scripts that run in the SambaStatus module".

Now I see the source for “Share.php” if I run the “smbstatus -S” I just see something like this:

> Service      pid > Machine       Connected at                     Encryption   Signing
> sistemas     14126   192.16b.xy.23 Tue Oct  2 10:32:43 AM 2018 MDT  -            -           
> movilizacion 7285    192.16b.xx.90 Fri Oct  5 08:16:52 AM 2018 MDT  -            -           
> sistemas     7380    192.16b.xx.25 Fri Oct  5 08:18:37 AM 2018 MDT  -            -           
> sistemas     7010    192.16b.xx.18 Fri Oct  5 08:12:02 AM 2018 MDT  -            -           
> movilizacion 7250    192.16b.xx2.91 Fri Oct  5 08:16:11 AM 2018 MDT  -            - 

The script for Share runs
$command= $sudo . “smbstatus -S | grep CEST | awk '{print $1 “\t” $3 “\t” $4”/"$5"/"$6 " " $7}’ | sort";

And there is no “CEST” info to show.


(Markus Neuberger) #86

You found the bug, it’s not compatible to other timezones!


(Enrique D) #87

LOL :rofl:

image


(Markus Neuberger) #88

How did you solve it?


(Enrique D) #89

You solved.
I just simple change CEST for MDT my time zone:
$command= $sudo . “smbstatus -S | grep MDT | awk '{print $1 “\t” $3 “\t” $4”/"$5"/"$6 " " $7}’ | sort";

:upside_down_face:


(Markus Neuberger) #90

What about this? Compatible to any timezone:

$command= $sudo . "smbstatus -S | grep `date +%Z` | awk '{print $1 \"\t\" $3 \"\t\" $4\"/\"$5\"/\"$6 \" \" $7}' | sort";

(Enrique D) #91

It works!

Now I wonder why I don’t see the “filenames” in the “Locked” tab
It only shows the Directories in “File Name”:
image

Right now I have an image file opened since I began to post here today.


Stop the press! It shows filenames now!
I just start browsing for more image files and they shows now:


Then after some moments (writing this comment) again the filenames disappear…
This is an expected behavior?
image


(Alessio Fattorini) #92

@gecco I guess you should modify your code after @mrmarkuz suggestion?


(Carlo Minucci) #95

i fix it!


(Carlo Minucci) #96

new version, with all patch and bugfix, is ready
http://minucci.net/nethserver/nethserver-sambastatus-7.0-2.x86_64.rpm


(Gerald) #97

Too bad I can not install it, probably gives a problem with the language file!

[root@openzwo ~]# rpm -i nethserver-sambastatus-7.0-2.x86_64.rpm
    	file /usr/share/nethesis/NethServer/Language/de from install of nethserver-sambastatus-7.0-2.x86_64 conflicts with file from package nethserver-lang-de-1.2.15-1.ns7.noarch
    [root@openzwo ~]#

(Enrique D) #98

I got this messages:

rpm -i nethserver-sambastatus-7.0-2.x86_64.rpm
file /etc/sudoers.d/30_nethserver_sambastatus from install of nethserver-sambastatus-7.0-2.x86_64 conflicts with file from package nethserver-sambastatus-7.0-1.x86_64
file /usr/share/nethesis/NethServer/Language/en/NethServer_Module_SambaStatus.php from install of nethserver-sambastatus-7.0-2.x86_64 conflicts with file from package nethserver-sambastatus-7.0-1.x86_64
file /usr/share/nethesis/NethServer/Language/it/NethServer_Module_SambaStatus.php from install of nethserver-sambastatus-7.0-2.x86_64 conflicts with file from package nethserver-sambastatus-7.0-1.x86_64
file /usr/share/nethesis/NethServer/Template/SambaStatus/Joined.php from install of nethserver-sambastatus-7.0-2.x86_64 conflicts with file from package nethserver-sambastatus-7.0-1.x86_64
file /usr/share/nethesis/NethServer/Template/SambaStatus/Share.php from install of nethserver-sambastatus-7.0-2.x86_64 conflicts with file from package nethserver-sambastatus-7.0-1.x86_64


(Markus Neuberger) #99

I can confirm this issue, as soon as german language is installed the update of sambastatus does not work.
It’s not possible to have German language and sambastatus installed.

I didn’t get these messages. As a workaround you may try to remove sambastatus with yum remove nethserver-sambastatus and reinstall with yum install nethserver-sambastatus-7.0-2.x86_64.rpm.


(Carlo Minucci) #100

I investigated but i don’t know where is the problem. If you want you can install this package http://minucci.net/nethserver/nethserver-sambastatus-7.0-3.x86_64.rpm and then add manually the “de” localization from github https://github.com/carlominucci/SambaStatus/tree/master/Language/de


(Enrique D) #101

Maybe because I manually edit the php scripts?
Tomorrow I’ll try your suggestions
Regards!


(Markus Neuberger) #102

I don’t think so, I edited them too.