Bash Script Question

liunx

Guest
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:<br /><br />/bin/sh: /home/path-to-my-files/backup.sh: /bin/sh<br />: bad interpreter: No such file or directory<br /><br />/bin/sh is telling me the /bin/sh does not exist? does anyone understand that?<br /><br />Thanks in advance<br /><br />Gordon~<!--content-->
Hi Gordon,<br /><br />Welcome to the forums <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /> <br /><br />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.<!--content-->
Welcome to the forum, Gordon. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Welcome to the forum, Gordon! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/cool.gif" style="vertical-align:middle" emoid="B)" border="0" alt="cool.gif" /><br /><br />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. <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/smile.gif" style="vertical-align:middle" emoid=":)" border="0" alt="smile.gif" /><!--content-->
Welcome to the forums, Gordon! <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/thumbup1.gif" style="vertical-align:middle" emoid=":thumbup1:" border="0" alt="thumbup1.gif" /><!--content-->
Welcome to the forum, Gordon <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/kicking.gif" style="vertical-align:middle" emoid=":dance:" border="0" alt="kicking.gif" /><!--content-->
Welcome to the forum, Gordon <img src="http://www.totalchoicehosting.com/forums/style_emoticons/default/biggrin.gif" style="vertical-align:middle" emoid=":D" border="0" alt="biggrin.gif" /><!--content-->
 
Top