Skip to content
This repository has been archived by the owner on Sep 5, 2022. It is now read-only.

exit code 1 #3

Closed
cobod-tilmann opened this issue Dec 13, 2019 · 12 comments
Closed

exit code 1 #3

cobod-tilmann opened this issue Dec 13, 2019 · 12 comments

Comments

@cobod-tilmann
Copy link

With the new version I can't get it to run.
Whatever I try, DWC always gives me a M7722 Error: exit status 1 message.

@wilriker
Copy link
Owner

That means the called program does return exit code 1. Can you tell me what you are calling?

@cobod-tilmann
Copy link
Author

sudo execonmcode -mCode 7777 -command "sudo /opt/dsf/sd/mcodes/./M7777.sh" &

@cobod-tilmann
Copy link
Author

cobod-tilmann commented Dec 13, 2019

and the script itself is this:
# !/bin/bash
echo $(date)" - $1" >> /opt/dsf/sd/mcodes/M7777_response

@wilriker
Copy link
Owner

wilriker commented Dec 13, 2019

Since you are running execonmcode already as root (due to the first sudo) it will also run all commands as root. So can you please retry without the sudo in the -command?

Also it might just be a typo or a copy&paste error but you have a space in your shebang between # and !. And it's better to have a shebang like #!/usr/bin/env bash but that should not be the problem.

EDIT: I try to replicate at the same time here.

@wilriker
Copy link
Owner

OK, I see the same problem when I have sudo as part of the command being executed. I try to find out what the issue is. It works for me when leaving out the "inner" sudo.

@cobod-tilmann
Copy link
Author

cobod-tilmann commented Dec 13, 2019

alright, so there is progress - the Command executes now, but the variable won't come through..
sudo execonmcode -mCode 7777 -command "/opt/dsf/sd/mcodes/./M7777.sh %F" &
The DWC reports M7777 F"Hello World"
however, the script only writes this:
Fri 13 Dec 14:07:41 GMT 2019 -
Fri 13 Dec 14:08:17 GMT 2019 -
Fri 13 Dec 14:11:52 GMT 2019 -

EDIT: I changed the script to your recommendations:
#!/usr/bin/env bash
echo $(date) - $1 >> /opt/dsf/sd/mcodes/M7777_response

@wilriker
Copy link
Owner

I have a very similar test program written in fish script. With that it works. With your code it does not. It must be some bash problem. But I cannot see anything obviously wrong.

@wilriker
Copy link
Owner

I see what the problem is, I just don't see where that is coming from. Meanwhile if you replace $1 in your code by "$@" it works. Somehow there is at least one empty parameter passed. I'll try to find out where this comes from.

@cobod-tilmann
Copy link
Author

Oh yes, that works :)
hmm.. now, that might be a stupid question - but could it be a problem with the % in the command being used in bash for variable manipulation?

@wilriker
Copy link
Owner

No, I see that it is inserted already when constructing the command to call. I need to leave now but I will hunt that down and fix it. Thanks for reporting.

@cobod-tilmann
Copy link
Author

Alright. Thanks for fixing :)

@wilriker
Copy link
Owner

Fixed in release 2.1.1.

It should now also work with sudo in the called command though I think it's unnecessary if execonmcode already runs as root.

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

No branches or pull requests

2 participants