manually creating Custom Commands

3 posts / 0 new
Last post
#1 Mon, 12/14/2015 - 15:35
dl

manually creating Custom Commands

Ubuntu 14.04 .. local development.

My Custom Commands are located in file pairs in /etc/webmin/custom.

e.g. 1438509195.cmd 1438509195.html

If I wish to create a batch of these file pairs manually - instead of through webmin main GUI - what is the indexing system used to create the 10 digit file names?

Is there a file naming method in webmin I can call?

Tue, 12/15/2015 - 15:03
dl

I've looked through custom-lib.pl to find reference to index 'id' (10 digit number) which prefixes command files in /etc/webmin/custom

# Save a custom command
&open_lock_tempfile(FILE, ">$module_config_directory/$c->{'id'}.cmd");

# Save HTML description file
&lock_file("$module_config_directory/$c->{'id'}.html");

but it's still not clear how/where the file id's are created.

Later edit:

I tried cloning an existing (working) file set and changed the file id's manually using a random 10 digit number - 9123456789.cmd and 9123456789.html. I then restarted webmin.

This approach works and I see custom commands added in webmin.

But it would be interesting to understand the indexing method.

Fri, 02/26/2016 - 20:01
joe443

The file id appears to be a timestamp, in seconds since January 1, 1970. Try a web search for

unix date in seconds

and you will find recipes (and websites) for generating your own.

Topic locked