Inside my ruby script I need to run a script sh which is located in another machine (opening an ssh connection?) and then continues with my program.
So:
my ruby script (e.g: Machine 10.1.1.2)
generic command
generic command
...
RUN SCRIPT UPDATE.SH ON MACHINE 10.1.1.15
generic command
generic command
Related
Bellow command if i write inside a script (test.sh) and execute directly on the specific machine it works.
sshpass -p $HOST_PWD sftp testuser#host <<!
cd parent
mkdir test
bye
!
But when i try to run (directly below scrip or invoking the test.sh file in the specif path) in Jenkins with "Execute shall script on remote host using ssh" it failing with
sshpass: Failed to run command: No such file or directory
I have installed sshpass, lftp and rsync in the remote machine
Issue :
I have added export $HOST_PWD in .bashrc of specific machine as well as Jenkins but in not finding it
Script placed in specific machine, if directly executed the script in that machine it works even with $HOST_PWD. But not working if we invoke from jenkins either script or directly scrip using "Execute shall script on remote host using ssh"
Working with Changes :
Instead of $HOST_PWD if i added directly password it works.
I use NiFi on Windows 10 machine with installed Linux subsystem (Ubuntu).
My task is to execute bash scripts and commands using NiFi. I tried to use ExecuteProcess and ExecuteStreamCommand with selected commands like simply 'bash' or 'bash ls' for test purposes, but all I got was:
ExecuteProcess[id=4f530725-0171-1000-d1b1-7df587eada7e] /bin/ls:
/bin/ls: cannot execute binary file
If I try to pass basic Windows commands everything is OK.
Is there a way to run bash commands in my case?
I'm not a Windows user but according to the docs, in order to get to the Linux-style commands you have to run Bash.exe, so I'm guessing you'll need to specify -c as an argument followed by the Linux bash command you want to run (as a string), something like:
bash -c "ls"
Easy question.
I have a Python3 script on my remote node in the path ~/setup/inventory.py, and I am trying to execute it remotly.
So I took a look at the script resource, which is searching on my local machine for the script.
How do I get Ansible to run my remote Python3 script. Executing it normally would look like os python3 /setup/inventory.py ansible vscode bash
Use command or shell modules, depending on your case.
Something like
- name: execute my script
command: python3 /setup/inventory.py ansible vscode bash
I am just wondering is that possible to run one script (e.g. shell script, python script, etc.) in different environments?
For example, I want to run my script from Linux shell to docker container shell (which the container is created by the script)? In other words, keep the script executing the rest of commands on container (after into the container).
run.sh (#shell script)
sudo docker exec -it some_containers bash #this command will lead me to docker container environment
apt-get install curl # I want to also execute this command inside the docker container after I enter the docker container environment
# this is just one script
Your question is not very clear, but it sounds like this is a job requiring two scripts - the first script runs in your "Linux shell", and needs to cause the second script to be placed into the container (perhaps by way of the dockerfile), at which point you can have the first script use docker exec.
Please see the answers on this question for more information.
I have installed ansible on one machine and trying to execute commands on another (remote) machinge.
Ansible successfully installed
Able to reach all hosts (local and remote). Tested with
ansible all -m ping
This was successful
Trying to execute a simple command again
ansible all -a 'echo "hello world" > ~/test'
Executed successfuly. But the file test is not created.
Cannot find the reason why?
Executing a command via ansible -a is equivalent to the command module, see
command module.
It is not processed via shell, therefore, >> (as well as other redirection operators) and $HOME are not available
In your case I would use
ansible -m 'shell' --args 'echo "hello world">>/home/ansibleremoteuser/test' all
In this case you would use the shell module which allows redirections.