Jump to content

Recommended Posts

Posted

how can I run a bash script from a cron job? when I try to run a script I have for automating backups on other linux machines I get the following error from cron:

 

/bin/sh: /home/path-to-my-files/backup.sh: /bin/sh

: bad interpreter: No such file or directory

 

/bin/sh is telling me the /bin/sh does not exist? does anyone understand that?

 

Thanks in advance

 

Gordon~

Posted

Hi Gordon,

 

Welcome to the forums :)

 

Try just "/home/path-to-my-files/backup.sh" and you will need to ensure that the path /bin/sh is in the top of the shell file, and that the permissions are set correctly on the file to execute.

Posted

Welcome to the forum, Gordon! :)

 

You may also want to try adding "sh " in front of the command Andy suggested, in case the file you're trying to execute doesn't have execution permissions. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...