First: in your script, there's no shebang line, so the system won't know which interpreter to run it in
Second: in your script, you're trying to run a text file. If you want to just output the contents to a new file, use either cp or cat
Third: did you check the mails for user oracle? cron by default reports all output and error messages via mail to the user.
Fourth: is the executable bit set on your "script"?
Many issues here.
1) What are the permissions of go.sh and the rest of the files mentioned?
cd /home/oracle
ls -lad go.sh
ls -ald one.txt
ls -lad two.txt
2) The contents of "go.sh" make no sense and will give errors. It tries to execute a command called one.txt and put any output to STDOUT to file two.txt .
What is the script meant to do?
3) The error messages should be in unix mail for account oracle.
by shebang he means specify the shell in the first line of go.sh, such as
#!/bin/ksh
or else in your crontab line specify the shell: ksh go.sh
if you want to redirect the contents of a text file, just use the "cat" command:
cat one.txt > two.txt
Thank you all for your answers.
I did some modifications as per your suggestions, but the results are still negative.
Script still don't do what it should.
[oracle@dell ~]$ cat go.sh
#!/bin/bash
cp /home/oracle/one.txt /home/oracle/two.txt
[oracle@dell ~]$
[oracle@dell ~]$
[oracle@dell ~]$ crontab -l
46 8 * * 5 /home/oracle/go.sh
[oracle@dell ~]$
[oracle@dell ~]$
[oracle@dell ~]$ date
Fri Oct 30 08:43:57 CET 2009
[oracle@dell ~]$
[oracle@dell ~]$ ls -lad go.sh
-rw-r--r-- 1 oracle oinstall 57 Oct 30 08:43 go.sh
[oracle@dell ~]$ ls -ald one.txt
-rw-r--r-- 1 oracle oinstall 7 Oct 29 16:17 one.txt
[oracle@dell ~]$ ls -lad two.txt
ls: two.txt: No such file or directory
[oracle@dell ~]$
[oracle@dell ~]$ date
Fri Oct 30 08:53:40 CET 2009
[oracle@dell ~]$
[oracle@dell ~]$
[oracle@dell ~]$ ls -l *.txt
-rw-r--r-- 1 oracle oinstall 7 Oct 29 16:17 one.txt
[oracle@dell ~]$ ps -ef | grep cron
root 2494 1 0 Oct16 ? 00:00:00 crond
oracle 5877 26405 0 08:55 pts/0 00:00:00 grep cron
[oracle@dell ~]$
can you please point me in the right direction ?
What did i missed here ?
Glad you got it solved. Another angle you could have worked would be to run the script manually for your troubleshooting before scheduling in crontab. Always manually test before scheduling
To help debug your script:
Try adding 'set -x' as the second line of your script and see what happens when you run it. An alternative, if you do not want to modify the script, would be to run 'bash -x /home/oracle.go.sh' or 'pdksh -x /home/oracle/go.sh'. This will give you some good debug output for any error conditions that may exist.