Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Help with basic shell script. /bin/sh: source: not found

Tags:

bash

shell

cron

My cron :

45 10 * * * source /home/ThinkCode/Test/hello.sh

hello.sh :

#!/bin/bash
echo "helloworld"

The error it emails me :

/bin/sh: source: not found

What am I doing wrong? It is configuration/environment specific, so Googling didn't help much! Thanks..

like image 227
ThinkCode Avatar asked Jun 04 '10 15:06

ThinkCode


2 Answers

Real sh doesn't have source, only .. Either change the shell in cron to bash, or use . instead.

like image 70
Ignacio Vazquez-Abrams Avatar answered Oct 17 '22 08:10

Ignacio Vazquez-Abrams


Why are you sourceing the file from cron. Why not just execute it?

like image 35
Edward Dale Avatar answered Oct 17 '22 08:10

Edward Dale