Shell commands on a Linux server

I don't think this is possible but I thought I'd check here.

We have Domino servers that run on Linux platforms.

Is it possible for some Lotusscript to issue shell commands to that linux platform and get the output.

Ex; I'd issue the command; df -k and the output returned in a string.

I don't think the lotusscript command "shell" would do it as it would only issue the command on the client platform and even then, it only would return success or failure.

Shell would be the right command but the agent has to run on server and needs the correct execution run rights.

But what exactly do you want to achieve ?

It's basically security checks and verifications that we need to perform.

Most of the checks can be done from a Notes database I have. I define in a document, the ID of the check, a Title of the check, which server, and which database.

There are several checks I can run like a database field query (like open the Names.nsf DB, look up the server document, and bring back the names of all the administrators). It can also issue console commands, and bring back the output from trying to hit a URL to verify things.

With each check, I generate a text file identifying the ID, Server, database, who ran the test, when it was run and results of the test.

Some of the checks have to be done by issuing Linux commands. Things like checking the access flags of a file or directory and other simple things.

Yeah, I could write scripts on the server itself to perform these checks, but I was hoping that my LotusScript routine could just issue the command on the indicated server and return the output like the session.Sendconsolecommand does.

This really needs to be able to be run from the client side to make this worth while, otherwise I'll just be tackling it with KSH scripts or the like and FTP the results back to my PC.

Blast from the past (2005): https://invisible.ch/2005/06/02/lotus-notes-server-on-unix-waiting-for-a-shell-command/

In Linux you can -as you for sure know- redirect the output of every command to a file.

I usually create the command line I want to execute and then redirect it to a temporary file:

Shell( "df -h >/tmp/myOutputFile.log" )

For more complex "programs" I use another NotesStream to first dynamically build an "executeme.sh"- file and then run it using shell...

Then later in my code I can simply use a NotesStream to read the contents of the file and get the results or I can attach the myOutputFile.log to a richtextitem in a "result document".

You need to run the agent with "Allow restricted operations" on security tab and of course you need the right to run restricted agents in the server security tab on the server document.

And don't forget to clean up your temporary files after execution.

You can do it in a Java agent.

For inspiration look here: https://www.baeldung.com/run-shell-command-in-java

Search on Google ..lots of related stuff