For windows users

Hi,

if using windows it might be a good idea to install some ports of the basic gnu tools like cat / tail etc for example.

The one i used is UnxUtils download | SourceForge.net it’s old but works you unzip it in a folder somewhere and add the bin and usr/wbin folder your PATH system variable.

it’s not really neceassary as emoncms won’t produce any errors but certain things might not work. One thing i know of is viewing the emoncms log on the administration page. It’ll always be empty unless you have a (gnu) tail (port) somewhere availible. because admin/getlog uses the tail command. as soon as you have tail installed and the installation path added to your PATH system variable and restarted your webserver (wamp) it will work.

I’m not sure if there are other places where things like this are used but in my one year usuage of emoncms on windows, i never encounterd a problem without it. Viewing the log is not critical either as you can just view it in notepad or similar. Tail is only needed for viewing the last 25 lines inside the webpage on the administration page.

i’m certain this could also be solved by implementing a php version of tail but might be easier to just get the real tools installed just in case

The reliance on tail (while I understand it) is daft - I’ll submit a PR to clean that up…

PR submitted…

Update: merged

2 Likes

thanks works pefect on windows :slight_smile:

There’s another dependency but not needed and i’m affraid there might not be an easy way to get this working under php…

To display server uptime “uptime” command is used which does not exist on windows.

this is however not a problem as it won’t produce any errors just empty data. There is however an “official” KB article on the microsoft site about uptime.exe program that works perfectly as a replacement.

https://support.microsoft.com/en-us/kb/232243

So if people want to see the uptime of their server on windows just download the referenced uptime.exe tool in that KB article and place it somwhere like c:\windows or whatever as long as it accessible from anywhere without typing an absolute path.

Also do note uptime tools on windows 10 display more days even if you rebooted your pc this is due to fast-boot which is enabled by default on windows 10 and doesn’t actually fully shutdown your pc so uptime.exe might display more days.

Works fine here and if windows links to the tool in an official KB article i’m guessing it’s an official tool somehow which people need to install if they want to use this feature

here’s what it displays if you use uptime exe from that kb article. If you don’t install it uptime data will show nothing.
It shows current time + uptime

I think the best way forward from here, is to check the output from running ‘uptime’ - and if there is no output - display nothing.

That way the page will be clean on Linux and Windows OS’

that’s indeed an option but if users don’t see the text “uptime” being empty on the admin page how would they know that it could display that. The only way i see is to document it then in the documentation that windows users could get uptime.exe from that kb article to get the same functionality. But still seeing empty data with “uptime:” might give users a quicker idea that this is possible than just documenting it as not all users will probably read it but they will probably go once to the admin page and perhaps notice that uptime is not being displayed if they ask about this we can also reference them to the documentation or the KB article to make it work on windows.

I also don’t know if time needs spinding on this one it’s not as critical as the php errors that used to come until a pr was done to fix them and not as critical as not being able to show the last log entries.

I’m also not certain many people use emoncms on windows i know i do but not sure if there are or will be many others. IMO as long as it does not produce errors it’s okay so the php errors that have been fixed is a good thing. The tail one is also a good thing but the uptime thing not sure if it’s really needed and what the best way to go is. Like hiding it completly with no mention of uptime or to display “uptime:” with no data so users still know it should display uptime there. (that’s what it was doing all the time, i only noticed it today)

OR there might be a better way …

Detect os being windows then check if the uptime command produced a result if not place a link to the KB article and mention that windows users should install that tool from the kb article to display uptime. If uptime does produce a result a uptime binary on windows is availble somewhere and nothing needs to be done either. For linux users no checks are needed and you can just run uptime.

not sure what others think ? not sure about linking against the kb article either as it might break in the future