Cronjob problems...

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cronjob problems...
# 1  
Old 10-03-2002
Data Cronjob problems...

Hi All!

I have a problem with one of my scripts. When I run the script from the command line : ./myscript.mac, it runs fine, but when I schedule it to run as a cronjob I get the following error :

Your "cron" job on cssp4
/d2/scripts/myscript.mac > /dev/null
produced the following output:

/d2/scripts/myscript.mac: does: cannot open

All the script does is call a .sql file that checks for invalid objects in the database. Why can I run it from the command prompt but not via crontab?

# 2  
Old 10-03-2002
If your script is running from the command line, but failing via cron, and it complains of not finding/being able to open something it might be due to an undefined variable.

Ensure you are declaring all the variables in the script that it needs, where it not running in a login shell. Take a look at the variables set as part of your login shell and if some of them are used by the script, make sure you have declared them in it.
# 3  
Old 10-04-2002

Also the PATH can be different from the cron and the command line

Last edited by janr; 10-04-2002 at 11:11 AM..
# 4  
Old 10-08-2002
All the enviroment variables for the 'user' Cron (not a real user but a 'pretend' user that runs the scheduled tasks) could be differnet to the user who owns the script.

Does it run ok when you use /d2/scripts/myscript.mac ?
# 5  
Old 10-08-2002
Please check the path and still if u find the same problem

go to the prompt and type

cron -e

this opens an cron editor in that set the job and write quit before getting in to these operations check the permissions of the file myscript.mac (it should have the read and execute permissions)
Hope this will solve the problem
# 6  
Old 10-08-2002
i have the same sorta thing going on here.

i have a cron job that executes some sql files.

hostname:/scripts# ls -l riv-data.ksh
-rwxr-xr-x   1 username group      306 Aug 13 08:50 riv-da
hostname:/scripts# cat riv-data.ksh
. /execute/users/environment/here
cd /path/to/sql/files
/usr/informix/bin/isql -s standard inventory.sql
/usr/informix/bin/isql -s standard inventoryLOT.sql
/usr/informix/bin/isql -s standard orderdetails.sql
/usr/informix/bin/isql -s standard orderheaders.sql
/usr/informix/bin/isql -s standard whse.sql

from what it sounds like you have the word "does" somewhere in your script. find it and take a look at what you are trying to do.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers


How to set cronjob for 48 hours. I can set for 2 days as shown below. * * */2 * * It is creating confusion for 30 days & 31 days per month. (3 Replies)
Discussion started by: Nishit
3 Replies

2. UNIX for Dummies Questions & Answers


Is the cronjob below can run only first wednesday of every month? 30 5 1-7 * 3 command please tell me (3 Replies)
Discussion started by: Anjan1
3 Replies

3. AIX

SH Script Execution Problems with Cronjob

Hi, I have created a sh script to startup and shutdown the oracle database, when I execute the script thru command line it execute successfully, but when I call the script thru cronjob it does not execute. The scripts are as follows: LOG=/oracle/times.log export ORACLE_SID=prod echo... (6 Replies)
Discussion started by: lodhi1978
6 Replies

4. UNIX for Dummies Questions & Answers

how to cancel a cronjob if the cronjob still running

hi everyone I'm newbie in this forum hope I can get some help here :) I have a command in crontab that executed every 1 minute sometime this command need more than 1 minute to finish the problem is, the crontab execute this command although it's not finish processing yet and causing the system... (7 Replies)
Discussion started by: 2j4h
7 Replies

5. Shell Programming and Scripting


Hi, I'm totally new to shell scripting. I need help in my crontab script. I'm trying to read some values from user (username, log file directory, server) and then use those value to create a crontab for log rotation after some interval of time. creating crontabs manually isn't big deal.... (11 Replies)
Discussion started by: MisterKhan
11 Replies

6. Shell Programming and Scripting

Problems in running a Perl script via cronjob

I have a very basic perl script that attempts to find if a process is running. If the process is not running then the script is supposed to start the process. If I execute the script from command line it works fine as expected. However if the script is executed via cronjob, the script cannot find... (1 Reply)
Discussion started by: ypant
1 Replies

7. Solaris

at vs cronjob

HI, What is the differnece between at / con job? thanks in advance. (1 Reply)
Discussion started by: mokkan
1 Replies

8. UNIX for Dummies Questions & Answers


hi iam new at unix.iam running a cronjob,which i want to run on the first day of every month at 1AM.this is what i have specified: 00 01 1 * * is this corect? (1 Reply)
Discussion started by: wiz83
1 Replies

9. HP-UX


Dear Guru, I have submitted some cronjobs that has been running for quite sometimes. However, today I counter some cronjob did not run. Can you please explain what causes this to happen. Any system setting that limit number of cronjob per minutes to be started, etc? Thanks. Kelly (1 Reply)
Discussion started by: hcng08
1 Replies

10. Shell Programming and Scripting


Please can someone help me. I need to set up a cron job to measure CPU usage, Disk I/O and memory usage over a period of 1 minute along with the number of users logged into the system. I also need to send it to another user besides myself every hour. Please can someone help me! Thanks. (4 Replies)
Discussion started by: gerwhelan
4 Replies
Login or Register to Ask a Question