We have a bunch of python scripts that need to be activated periodically, on local as well as server machines. I also have a bunch of handy bash scripts I use to migrate client wordpress projects to export databases, compress directories, etc which the FTP node can perhaps download.
Could they be a node that lets you run a shell command and proceeds based on the response?
Just as an example, I created a workflow that runs a file called test.py and proceeds based on the output of the python program. The python file contains the following code: print 'Yo'.
Hey @saitor! Welcome to the n8n community. I hope you enjoy your time here.
It sounds like the Execute Command integration is what you are looking for. This this node runs a command on the host and then returns the results in the data of the node.
For example if you created this workflow:
using these parameters for the Execute Command node:
the output of the node would contain the working directory of the n8n service. In my case, I get:
Now, you can extend this capability to other systems using SSH (see here for a good sampling of remote SSH command execution scripts) or you can take a look at a more robust system like Ansible to manage the remote sessions.
I would agree with @jan. That would probably be the best way to do it as the processes inside the docker container are unaware that it is on the same system and it sees the “host” system as a separate system all together.
I’m test-driving Execute Command node on Windows.
The test command looks like this
mshta vbscript:Execute("msgbox ""this is an action"", 0,""action"":Close")
This is to open a OS-dependent message box via this n8n node.
However, although the command execution is a success, there is no expected pop-up message box.
The same command works as expected under Command Prompt.
Not sure how you run n8n exactly and not experience with windows any more but can not imagine that it works as n8n runs it in a totally different process which will probably not be able to display anything.
@jan Thanks for the quick reply! So what would you suggest if I were to open a GUI program locally from a commandline script? Say, giving user an opportunity to open a file during executing a node?
Sadly nothing. n8n was simply not created for that. So can right now not think of a good way to do that.
As soon as the wait-branch got merged could you make the workflow wait until a web form got filled. That form could the send the information to a webhook and which then starts the workflow again.