Custom Commands

4 posts / 0 new
Last post
#1 Sun, 07/30/2017 - 11:19
AllanIT

Custom Commands

I am trying to use Custom Commands to create a Custom Command button in Usermin that when clicked displays the current AWStats report for the domain of the user. But nothing I do works.

When I use $DOM/awstats/awstats.pl I get “Output from $DOM/awstats/awstats.pl .. /bin/sh: 1: /awstats/awstats.pl: not found”

If I use https://domain.ltd/awstats/awstats.pl I get “Output from https://domain.ltd/awstats/awstats.pl .. /bin/sh: 1: https://domain.ltd/awstats/awstats.pl: not found ”

However I can access the awstats report with https://domain.ltd/awstats/awstats.pl – username/password combination in a browser.

But no matter which combination of setting I use in Custom Commands I can not get the report to display when I click the button.

Should it be possible to create a Custom Command to display AWStats? If so can you please give me some pointers

thanks

Mon, 07/31/2017 - 09:31
scotwnw

That first command is being run from the command line, bin/sh. It needs to be called in same manner as if it was a browser link. So make the command something like 'wget https://domain.ltd/awstats/awstats.pl'. Which will open the link like a browser.

Tue, 08/01/2017 - 10:37
AllanIT

Hi scotwnw

Tried wget with many other settings including providing the Username/Password both in Parameter fields and directly in the url and got the error below.

Output from wget https://domain.ltd/awstats/awstats.pl .. --2017-08-01 21:32:51-- https://domain.ltd/awstats/awstats.pl Resolving domain.ltd (domain.ltd)... 0.0.0.0 Connecting to domain.ltd (domain.ltd)|0.0.0.0|:443... connected. HTTP request sent, awaiting response... 401 Unauthorized Username/Password Authentication Failed.

Any other suggestions?

PS. I am not even sure if it is possible. It just looks like it Should be possible with custom commands. Maybe Joe or Eric could chime in.

Fri, 08/18/2017 - 09:46
Joe
Joe's picture

Custom Commands are for command line tools, not for web apps. It could probably be tweaked to work with some kind of wrapper script, but it's going to be pleasant.

One way to achieve this would be to make a module for Usermin to do the job. A very simple wrapper can display HTML web pages. There's even already code to do it, and change all the links to point to the right places, inside of Webmin or Virtualmin, somewhere (since we have some embedded web pages in Virtualmin already). I'd have to poke around in the code some to figure out where it is.

Also, the Virtualmin AWStats plugin might be a good starting point. A Usermin variant would need to alter how it thinks of the world (Virtualmin runs as root and drops privileges when it can, Usermin runs as the user, and cannot elevate privileges, so everything has to be do-able by the logged in user).

--

Check out the forum guidelines!

Topic locked