-
-
Notifications
You must be signed in to change notification settings - Fork 588
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
Running background command using &
causes the step to halt and timeout
#40
Comments
Fixed by redirecting all output: |
@asymness thank you! I faced the same problem. Do you know why it works like this? I tried to find an answer to this question for several hours but found nothing. |
For some reason, the action keeps waiting for stdin, stdout, and stderr. That's why we need to redirect all three outputs to free the terminal. That's all I could gather from this... |
So I've had a very similar issue with docker compose. As per the suggestion I tried redirecting all three fds (input, output and error), but no luck, my github actions keep running and then timing out and failing. Here's the script: nohup sudo docker compose --env-file ./.config/.env up > nohup.out 2> nohup.err < /dev/null & Any help would be appreciated :) |
@Saljooq moving some something like: uses: appleboy/ssh-action@master
with:
key: ${{ secrets.KEY }}
host: ${{ secrets.HOSTNAME }}
username: ${{ secrets.USERNAME }}
script: |
./some_script ./some_script nohup ./some_other_script > nohup.out 2> nohup.err < /dev/null & I changed it to: uses: appleboy/ssh-action@master
with:
key: ${{ secrets.KEY }}
host: ${{ secrets.HOSTNAME }}
username: ${{ secrets.USERNAME }}
script: |
nohup ./some_script > nohup.out 2> nohup.err < /dev/null & |
wish I saw this earlier. Thank you bro💐 |
I am executing a command like this in the step:
python script.py &
echo Done
This causes the step to get stuck in progress after echoing Done and eventually timeout (after ~10 minutes) whereas it should be done in 10 seconds.
However, if I kill the process (python script.py) manually by SSH'ing to the server, the step completes execution successfully. How can I fix this problem and run background commands successfully?
Other variants I have tried:
nohup python script.py &
disown
The text was updated successfully, but these errors were encountered: