webhook: fork/exec: exec format error (question)

Hi, I have following settings:

[
  {
    "id": "redeploy-webhook",
    "execute-command": "/home/joseluis/test/hooks/redeploy.sh",
    "command-working-directory": "/home/joseluis/test",
    "response-message": "I got the payload!"
  }
]

I request the hook:

$ curl http://localhost:9000/hooks/redeploy-webhook
I got the payload!

On the terminal I got this error:

$ webhook -hooks hooks.json -verbose 
[webhook] 2015/12/06 16:58:02 version 2.3.6 starting
[webhook] 2015/12/06 16:58:02 setting up os signal watcher
[webhook] 2015/12/06 16:58:02 attempting to load hooks from hooks.json
[webhook] 2015/12/06 16:58:02 loaded 1 hook(s) from file
[webhook] 2015/12/06 16:58:02   > redeploy-webhook
[webhook] 2015/12/06 16:58:02 os signal watcher ready
[webhook] 2015/12/06 16:58:02 starting insecure (http) webhook on :9000
[webhook] 2015/12/06 16:58:07 Started GET /hooks/redeploy-webhook
[webhook] 2015/12/06 16:58:07 redeploy-webhook got matched (1 time(s))
[webhook] 2015/12/06 16:58:07 redeploy-webhook hook triggered successfully
[webhook] 2015/12/06 16:58:07 Completed 200 OK in 265.558µs
[webhook] 2015/12/06 16:58:07 executing /home/joseluis/test/hooks/redeploy.sh 
(/home/joseluis/test/hooks/redeploy.sh) with arguments 
["/home/joseluis/test/hooks/redeploy.sh"] and environment [] 
using /home/joseluis/test as cwd
[webhook] 2015/12/06 16:58:07 command output: 
[webhook] 2015/12/06 16:58:07 error occurred: 
fork/exec /home/joseluis/test/hooks/redeploy.sh: exec format error
[webhook] 2015/12/06 16:58:07 finished handling redeploy-webhook

My simple echo "Hello" command in redeploy.sh doesn’t execute. What am I doing wrong?

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 1
  • Comments: 23 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Can you add #!/bin/sh on top

That’s the problem. The first line must be something like this:

#!/bin/sh

Voilà now works fine! 😄

image

Always Shebang on top 😄

#!/bin/sh

Thanks a lot guys.