not running in cron


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users not running in cron
# 1  
Old 07-10-2003
not running in cron

I have written a shell script and when i run it from shell prompt it runs fine but in the cron it only runs partially.
That means cron is working fine.
there is a command which i am using in the script which doesn't run at all.
That comman uses different user privileges like ptadmin
i am not sure how to make this work.
What I am thinking is that particular comman exports the database from oracle and it take 20-25 min to execute it while i run manually. but in the cron it looks like it doesn't even try it.
Although i have checked the log file and cron is creating log file so its executing but.
Any thoughts fellows.

tx
# 2  
Old 07-10-2003
Check your environment differences between command line and cron.

$ env > /tmp/mycommandline.env

and add that command to your script
env > /tmp/mycron.env

Then check that you are giving the full path to commands in your script.

Read the man page on cron, crontab for further information such as:

The shell is invoked from your $HOME directory with an arg0
of sh. Users who desire to have their .profile executed must
explicitly do so in the crontab file.
# 3  
Old 07-11-2003
you could always just source your .profile or what ever into your script.

at the top of the script do a . ./.your_profile_goes_here
# 4  
Old 07-11-2003
thanks fellows..
I have added my commandline enviornment to my script ..
it didn't work but later on i changed my shell to k shell and it worked like piece of cake.
In ksh after my enviornment variable i used export.
e.g.
PATH=/usr/abc:/usr/bcd; export PATH;
..

does somebody know how to do the same in csh & bourne shell.

Thanks again
# 5  
Old 07-11-2003
sh would use the same command as ksh - csh would be

% setenv PATH /usr/abc:/usr/bcd

For csh, you would put this in the .login file, not the .profile.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Cron job running even after cron is removed

Hi , I have removed a cron for particular user , but cron job seems to be running even after the cron entry is removed. The purpose of the cron was to sendmail to user ( it uses mailx utility ) I have restarted cron and sendmail service still user is getting mail alerts from the cron job. And... (4 Replies)
Discussion started by: chidori
4 Replies

2. Shell Programming and Scripting

Check what cron is running

How to check what cron is scheduled to run? I don't want to modify anything. Thanks (1 Reply)
Discussion started by: stevensw
1 Replies

3. Solaris

Script not running from cron

Hi, I''ve made a script that's running fine from the command line but when running from cron it encounters the following issue: /tmp/tstscript/testfail.ksh: typeset: not found I've searched in Google and couldn't find anything, here's the beggining of the script (I can post the rest if... (4 Replies)
Discussion started by: Cvg
4 Replies

4. Solaris

Running Dialog using Cron

Folks, I have a solaris 10 system. I am having trouble with cron to run a dialog command. When I simply execute below using a cron it does not work. I am new to the forum, please help me to understand it better. Thanks in advance. #!/bin/sh dialog --infobox "Please wait " 10 10 (2 Replies)
Discussion started by: wndgs
2 Replies

5. UNIX for Advanced & Expert Users

Cron not running

Hello All, I have installed a few crons on a machine. But for some reason the crons just don't run. I have checked the permissions on the files and also restarted the cron daemon. But it doesn't seem ti help. Can anyone suggest any other things I can do to get it running again? Regards,... (6 Replies)
Discussion started by: garric
6 Replies

6. Shell Programming and Scripting

Cron not running .. please help

i have a simple script that ftp a file out, manually running it works fine. #!/bin/sh ftp 152.226.69.48 << cmd bin get applicant_vw.txt quit cmd but when I cron it, 14 9 * * * /opt/home/XXX/XXX/dailyjob.sh > /opt/home/XXX/XXX/cronlog.txt seems that it was executed because i can... (2 Replies)
Discussion started by: beisaikong
2 Replies

7. UNIX for Dummies Questions & Answers

How to tell which cron jobs are still running?

I have some cron jobs that are taking a might long time. That is because they are screen scrapers and I inserted an extra long pause (10 minutes between screens) to be extra polite and minimize network traffic. I was going to have them run once a day but now I'm thinking once a week. How do I... (2 Replies)
Discussion started by: siegfried
2 Replies

8. UNIX for Dummies Questions & Answers

running cron jobs

I would like to add a job using cron. I have following questions - cron jobs are launched using what login-id e.g. is the script launced using my login-id - In which directory would the cron jobs be launched ? - where do the environment variables required in the script being lauched come... (3 Replies)
Discussion started by: sharanbr
3 Replies

9. HP-UX

Cron Job Not Running

Hi, I have a cron schedule like this 04,16,28,40,52 * * * * /nag/startProcessABatch (unix script) i want to add new lines in this file (like Logging), i just copy this file into a /tmp folder (for backup copy), and i have edited this file (added few lines of code for logging). ... (1 Reply)
Discussion started by: nag_sundaram
1 Replies

10. Shell Programming and Scripting

Running script using cron

I am running a script by scheduling it using the cron. The line in the cron file is - 10 * * * * ksh -v /apps/gofis/svam/cos_automation/cos_automation.sh vpqa > /apps/gofis/svam/cos_automation/cron.log 2>&1 But after the job is executed, the cron.log contains some part from... (4 Replies)
Discussion started by: ankurgupta
4 Replies
Login or Register to Ask a Question