31

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..

ThinkCode
  • 7,841
  • 21
  • 73
  • 92

2 Answers2

79

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

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
9

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

Edward Dale
  • 29,597
  • 13
  • 90
  • 129