3

When running the below command,

* * * * * /home/path1/path2/myScript.sh >>/home/path1/path2/Logs/output.txt 2>&1

I got the following error

bash: apache-solr-1.4.2-dev.zip: command not found
// if we delete this folder/zip from its location it goes to the below error. 
// It is just taking some folder names and throwing errors
bash: apache-solr-1.4.2.zip: command not found
bash: apache-solr-1.4.zip: command not found
bash: someFolder.zip: command not found
bash: someFolder2.zip: command not found
bash: someFolder3.zip: command not found

myScript.sh contains:

echo "this is my script"

I can't understand the relation between Solr and Cron job. Please help me out.

S K padala
  • 251
  • 2
  • 3
  • 16
  • The error is coming from `myScript.sh`, not from `cron`. Check your `myScript.sh`. – sat Feb 24 '16 at 07:22
  • I've edited the question with myScript.sh, can I know how to over come this! @sat – S K padala Feb 24 '16 at 07:24
  • The error messages is from the shell - they're generated when you're just pasting the line meant for the cron configuration file into the terminal. – MatsLindh Feb 24 '16 at 22:36

3 Answers3

2

To configure cron, you'll have to edit the users cronfile. You can usually do this by doing crontab -e logged in as the actual users. This will launch $EDITOR and let you edit the current cron file.

You'll need to enter the cron configuration into this file, and not just pasting it on the command line as you're doing.

* * * * * /home/path1/path2/myScript.sh >>/home/path1/path2/Logs/output.txt 2>&1

The error messages you're getting is from the *s being expanded into the actual contents of the directory you're inside.

MatsLindh
  • 49,529
  • 4
  • 53
  • 84
2

I've run the cron job command directly instead of creating/editing the cron job. After ruuning the command using

crontab -e

it worked fine.

Thanks for replies.

S K padala
  • 251
  • 2
  • 3
  • 16
0

The cron job does nothing else than to start myScript.sh at certain times. I think you get the error message because you are referring to that apache-solr-1.4.2-dev.zip or to something that the apache-solr-1.4.2-dev.zip does from within the script myScript.sh. So, the error message has to do with the script and not with the cron job. To find the cause for the error, you will have to fix the script.

Otterfinger
  • 369
  • 1
  • 3
  • 8
  • 1
    OP gave the content of the script. No reference to apache-solr... I think more about a badly-located wildcard. – Dunatotatos Feb 24 '16 at 07:35