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

Job failed with error: Script failed: No such file or directory #5

Open
ovizii opened this issue Apr 15, 2023 · 6 comments
Open

Job failed with error: Script failed: No such file or directory #5

ovizii opened this issue Apr 15, 2023 · 6 comments

Comments

@ovizii
Copy link

ovizii commented Apr 15, 2023

I am trying my hand at running your image and my first test when using the shell script plugin was to run a simple ping 5x and it works.

Now I am trying to run a slightly more complex script and it fails with this error:

# Job failed with error: Script failed: No such file or directory (spawn /tmp/cronicle-script-temp-jlgi3hay503.sh ENOENT)
# 1 retries remain (1 min delay)

All I can find when googling that is this, but I am not sure how to fix it or if it is my script at fault:
jhuckaby/Cronicle#587
jhuckaby/Cronicle#133

They are talking about the /tmp folder possibly being protected from code being executed, but then why would the first test wit ha simple ping work?

Working example:
image

Problematic example:

#!/bin/bash
if curl -I "https://sub1.domain.tld/login.html" 2>&1 | grep -w "200\|301" ; then
   curl "https://sub1.domain.tld/login.html" -s -o /dev/null -w "%{time_total}" | xargs -I [] curl -k -s "https://sub2.domain.tld/api/push/secret?msg=OK&ping=[]"
else
   curl -k -s "https://sub2.domain.tld/api/push/secret?status=down"
fi

I'd appreciate any pointers.

@soulteary
Copy link
Owner

Hello @ovizii , there are two best practices when I personally use:

  1. Based on the current image as the base image, build images with curl, wget, and even python, which can execute complex scripts
  2. Only use this image to call other programs for execution, stripping the complexity, and this program is only used as a trigger

@ovizii
Copy link
Author

ovizii commented Apr 18, 2023

Ah, I see. Sounds logical and doable, as originally I had a script which I was calling via crontab, so I guess I can just call it with this image then.

@ovizii ovizii closed this as completed Apr 18, 2023
@ovizii
Copy link
Author

ovizii commented Apr 18, 2023

OK, need to add a second question after reading your reply to #6

So you mean, I can just mount a volume into this container which contains the scripts I want to call on the docker host, right?

@ovizii ovizii reopened this Apr 18, 2023
@soulteary
Copy link
Owner

I saw this issue was opened again, maybe what's missing here is a simple blog post or best practice :)

// Sorry for being overwhelmed by thousands of squeezed issues, did not see the message reminder @ovizii

@a-reda
Copy link

a-reda commented Oct 21, 2023

  1. Only use this image to call other programs for execution, stripping the complexity, and this program is only used as a trigger

@soulteary
How would you trigger a script in the host machine? using ssh?

@soulteary
Copy link
Owner

soulteary commented Nov 11, 2023

  1. Only use this image to call other programs for execution, stripping the complexity, and this program is only used as a trigger

@soulteary How would you trigger a script in the host machine? using ssh?

hey, I usually use a webhook software, I remember I pushed a fork project, you can search for it on my personal page. @a-reda

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

3 participants