Skip to content
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

why I get an error :"Process exited with status 1" #111

Closed
00LT00 opened this issue Mar 17, 2021 · 4 comments
Closed

why I get an error :"Process exited with status 1" #111

00LT00 opened this issue Mar 17, 2021 · 4 comments

Comments

@00LT00
Copy link

00LT00 commented Mar 17, 2021

the result is:

======CMD======
cd BigDirectorGo/
lsof -i:12309
lsof -i:12309 | awk 'NR>1 {print $2}'|xargs kill -9
nohup ./main > nohup.out 2>&1 &
echo "reload success"
lsof -i:12309

======END======
out: COMMAND   PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
out: main    24105 root   11u  IPv6 32920645      0t0  TCP *:12309 (LISTEN)
out: reload success
2021/03/17 18:32:58 Process exited with status 1

Why does this "lsof -i:12309" command exit with status 1?

@Stas-AbsoluteDesign
Copy link

Stas-AbsoluteDesign commented Oct 27, 2022

@appleboy I am getting the same strange error during the execution of a simple command.

The pipeline step that fails:

-   name: Rollback on "Release Deploy" step error
    id: rollback_release_deploy
    if: steps.release_prepare.outcome == 'success' && steps.release_deploy.outcome != 'success'
    uses: appleboy/ssh-action@master
    env:
        ROOT: ${{ secrets.DEV_REMOTE_TARGET }}
        RELEASE: ${{ secrets.DEV_REMOTE_TARGET }}/releases/${{ env.release_name }}
    with:
        host: ${{ secrets.DEV_REMOTE_HOST }}
        username: ${{ secrets.DEV_REMOTE_USER }}
        key: ${{ secrets.DEV_REMOTE_SSH_KEY }}
        envs: ROOT
        script_stop: true
        script: |
            #### swap back to the  previous release
            cd $ROOT
            [ -e previous ] && rm current && mv previous current
        debug: false

As you can see, apart from passing the $ROOT folder path, there is nothing special.
So in a few words: we cd into that $ROOT folder and check if the previous symlink exists - then remove it and move the previous symlink into current (basically, reverting the recently failed release to point to an old release folder).

However, the output for a such single-line script is:

======CMD======
#### swap back to the  previous release
cd $ROOT
[ -e previous ] && rm current && mv previous current

======END======
err: 
out: 
out: 
out: 
2022/10/27 19:03:01 Process exited with status 1

However, if you delete directive script_stop: true
It will output success:

======CMD======
#### swap back to the  previous release
cd $ROOT && [ -e previous ] && rm current && mv previous current

======END======
==============================================
✅ Successfully executed commands to all host.
==============================================

P.S.
As @00LT00 said, there is nothing more to investigate as even "debug: true" does nothing at the output is exactly the same.

P.P.S.
Also, I was getting the same error when tried to pass a pretty complicated bash script with IF...THEN logic. It was executing well in the shell, but once I paste that script into the pipeline, it fails with a "status code 1" error as per the above.

@miljan-aleksic
Copy link

Same here, if script_stop=true the execution will exit with status 1 even though there are no errors in the script.

@appleboy
Copy link
Owner

@miljan-aleksic Please remove the script_stop=true. Same problem with #335

@appleboy
Copy link
Owner

We move to #335 for further discussion

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants