Cronjob is not running

hi,
I have a shell script which has a sql plus code and unix if else condition.
The file is located at root.I logged in as a root user and i have all permissions. I tried to set up a cron job so that the script need to run every minute.the script is running successfully without any problem. I tried run the cronjob but it failed. Also I tried to run the cron job for the file, i am getting the error message
"crontab: error on previous line; unexpected character found in line."

after each line of the script.

I have setup the cronjob as 1 * * * * /dblink4.sh where dblink4.sh is the file name.

i even tried 1 * * * * /dba_jobs/dblink4.sh >> /dba_jobs/dblink4.sh 2>&1

where i copied the file in to another directory called dba_jobs and redirected.

Still, i am getting the same error.

Can anyone suggest me what could be the possieble solution for this. Please reply me ASAP

You cannot have both executable and out-file as same (yours dblink4.sh). ShellScripts are interpretable. And thus it reads one-by-one line and execute that. Now while you redirecting to same shell-script then your further instructions are gone.
Following cron entry should work, provided dblink4.sh is error-free!!!
1 * * * * /dba_jobs/dblink4.sh >> /dba_jobs/dblink4.out 2>&1

well... dont know if it help...

but did you turn the script executable?
like:

chmod +x filename

Was the first thing that i tought... as i usually forget to do that :slight_smile: