-
-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some commands don't work #31
Comments
Another approach is to put your command into the shell script file and execute |
The shell script is being able to run node js or npm commands. How can they be executed? Tried loading |
Any suggestions? - name: Executing remote command
uses: appleboy/ssh-action@v0.1.2
with:
host: ${{ secrets.hosts }}
USERNAME: ${{ secrets.USERNAME }}
PORT: ${{ secrets.PORT }}
KEY: ${{ secrets.SSHKEY }}
script: sh ../../scripts/deploy.sh If we try to execute |
I think it will try to execute inside the vps you're trying to ssh into. You could use
I think that should work |
@mojo706 It shows an error:
|
@mittalyashu could you show me your whole discord job? |
- name: Executing remote command
uses: appleboy/ssh-action@v0.1.2
env:
BACKEND_APP_PORT: 8080
NODE_ENV: "production"
with:
host: ${{ secrets.IP }}
USERNAME: ${{ secrets.USERNAME }}
PORT: ${{ secrets.PORT }}
KEY: ${{ secrets.SSHKEY }}
envs: BACKEND_APP_PORT, NODE_ENV
script: ls |
@mittalyashu try that |
Isn't it the exact same code which I have shared. |
Lol shit I forgot to change it. I guess I was tired, I wanted you to add |
You mean something like this? - name: Executing remote command
uses: appleboy/ssh-action@v0.1.2
run: echo "Running this in GitHub Action"
env:
BACKEND_APP_PORT: 8080
NODE_ENV: "production"
with:
host: ${{ secrets.IP }}
USERNAME: ${{ secrets.USERNAME }}
PORT: ${{ secrets.PORT }}
KEY: ${{ secrets.SSHKEY }}
envs: BACKEND_APP_PORT, NODE_ENV
script: ls |
with:
host: ${{ secrets.IP }}
username: ${{ secrets.USERNAME }}
port: ${{ secrets.PORT }}
key: ${{ secrets.SSHKEY }}
envs: BACKEND_APP_PORT, NODE_ENV
script: ls |
you need to have the |
Along the same lines, does anyone have a solution for cd not working? thanks |
@bnbrndn Post your config. |
I had some problem when i use root user access |
Did you find a solution @bnbrndn |
Only the first command works from script: Am I missing something?? @appleboy -- thank you!! |
The problem I was having was I needed to CD into a directory to run composer install. The work around I found was to run "composer install -d public_html" Not the cleanest, but it did what I needed |
I'm having the same issue. SSH to Windows Server only runs a single comand @ShravaniRoy did you ever solve this? |
This is crazy! the issue is yet not solved! I tried all different commands to run my @appleboy Please can you help. |
this issue is about interactive vs non interactive shell. you can check this at: basically, if you are running a command in a non interactive shell, like ssh-action, on many linux distros, "/etc/bash.bashrc" file has a specific command that returns only, so some of the files didn't run and some specific commands doesn't add to path,
just comment out the line that returns early and everything should work fine, or you can use the real paths of the commands that you would like to use. |
Thanks @kocyigityunus. The hint for using the real paths
works for me |
@ShravaniRoy @jgilm Were you able to overcome the issue? I am too facing a similar problem where I am not able to run multiple commands on the windows server |
Hey Magesh, We actually moved to the ubuntu server. This worked fine on Ubuntu. |
@ShravaniRoy Thanks for the quick response. Created a separate issue for the same #189 |
Hey, went through the answers and tried different approaches but nothing worked. - name: Executing remote command
uses: appleboy/ssh-action@v0.1.2
with:
...
script: sh ./my-script.sh In other CIs or terminal where this nice appleboy/ssh-action doesnt exist, to make it work you pass your own shell script as: ssh root@${server} 'bash -s' < ./my-script.sh |
Here is my config
Below is my sh file
But while action run on git hub, it is giving below error
Below first two command working perfectly fine but not sure why npm and forever not working. npm & forever command I am able to execute from putty.
|
Using the full path of the binary in the script worked for me. I believe the non interactive shell obtained from appleboy does not load the correct profiles. // Example Hope using this or other tools would work. |
The full path didn't work for me, but I found a solution. I realized that if I run Reason: interactive vs non-interactive shell see → #31 (comment)
Solution for npm: #21 (comment)
General solution:
|
Thanks @kocyigityunus. Commenting the .bashrc line solved my issue. As my workflow runs nvm, yarn and docker scripts, that was the easiest way to handle |
I will update the README to address the @kocyigityunus solution. |
Another solution that works (only for node global modules): script: |
PATH="$PATH:$(npm get prefix)/bin" # Adds global node modules to the PATH
pm2 list # Uses a global node module, now in the PATH |
no file |
Currently I do not have issues with that, but I do not use bash on my servers anymore. Instead, I use zsh. |
I have found a good solution, just add a line to your script, eg: script: |
source /etc/profile
java -version the /etc/profile is working for |
This is a valid linux command that removes all files and folders that don't match the pattern, it works when I run it manually on my server, but it doesn't work using this ssh-action tool.
The text was updated successfully, but these errors were encountered: