Cron - Not working properly


 
Thread Tools Search this Thread
Operating Systems HP-UX Cron - Not working properly
# 8  
Old 10-29-2007
Erm, when you run 'unzip myfile.zip', are you running the command from the directory where myfile.zip is present? What I mean is, does your cron script actually do a 'cd' to the directory where the myfile.zip file is present?

When you run the script you might be running it from the directory where the file is already present. However, when a script runs through cron, the working directory is usually the home directory of the user whose cron is running the script.
# 9  
Old 10-30-2007
Hi,
The locations are given correctly. Even I tried running my script from the home directory, by giving the whole path. Its executing perfect. the only probelm is when i schedule my script in cron, its throwing the error. I do have many operaiton in my script. Like unzip, I use sql loader , sql plus commands too. All are giving error when scheduled in cron. So what else can be done ???

I tried /usr/bin/unizip .. Its telling
ksh : /usr/bin/unizip : not found
# 10  
Old 10-30-2007
Make sure your paths are correct. I see you've got "/usr/bin/unizip" instead of "/usr/bin/unzip". Check for where your commands are using "whereis cmd_name", e.g. %whereis unzip.
# 11  
Old 10-30-2007
Hi,
I gave whereis unzip. Its showing :

unzip:

So i too doubt the location about that command. But still , its working when i run the script manually, instead of using the CRON. As shown above for unzip, the same is coming for sqlldr and sqlplus. So how can i use them with cron ??

I am really confused about this situation..
# 12  
Old 10-30-2007
Is there any chance you can show us your entire script ??

It might be something else that you have in it that's causing it to run standalone and not via cron.
# 13  
Old 10-30-2007
I think posting your script might help.Just out of curiosity: Make sure you have $ sign in front of your commands in your script, e.g. $unzip file_name ,etc.
# 14  
Old 10-30-2007
Quote:
Originally Posted by mokgonec
I think posting your script might help.Just out of curiosity: Make sure you have $ sign in front of your commands in your script, e.g. $unzip file_name ,etc.
why is that?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Join not working properly

I want to join two files , with file 1 col 3 and file 2 col 1 as key. The join command is erratic for some reason. File 2 is a master file having all the names, and file 1 has some values. I want to add the names from fil2 in file 1. If I use the original master file, some output is missing. ... (16 Replies)
Discussion started by: ritakadm
16 Replies

2. Shell Programming and Scripting

Why is sort not working properly here ?

Platform: RHEL 5.4 In the below text file I have strings like following. $ cat /tmp/mytextfile.txt DISK1 DISK10 DISK101 DISK102 DISK103 DISK104 DISK105 DISK106 DISK107 DISK108 DISK109 DISK110 DISK111 DISK112 DISK113 DISK114 (8 Replies)
Discussion started by: kraljic
8 Replies

3. UNIX for Dummies Questions & Answers

~c is not working properly with -r option

Hi There, --------- file1 ------- ~c asd@ac.com -------------- Now i am using below command cat file1|mailx -s " testing" -r " My Name" abc@tech.com (3 Replies)
Discussion started by: Tapan Sharma
3 Replies

4. Red Hat

sudo is not working properly

This is the first time for using sudo for me. # visudo ## Allows people in group admin to run all commands %admin ALL=(ALL) ALL # groupadd admin # useradd temp # usermod -a -G admin temp # id temp uid=506(temp) gid=506(temp) groups=506(temp),507(admin) # #sudo... (5 Replies)
Discussion started by: getrue
5 Replies

5. UNIX for Advanced & Expert Users

Sendmail is not working properly

Hi All, Can any one help me to solve the issue. The Issue is, i have started the sendmail service on my RHEL 4 update 6 box, I am able to send the mail from my box to almost all of the Email Id's except few. Exampe, test mail. . Output is :the message is sent. now if I send the... (2 Replies)
Discussion started by: akhtar.bhat
2 Replies

6. Shell Programming and Scripting

cron does not execute script properly

I have a simple script that checks for certain printers and records them to a file. When I run the script manually at the command prompt, it works perfect, but when I run the script via cron, nothing happens. No errors reported, and no records are written out. I'm using Solaris 10. Below is the... (4 Replies)
Discussion started by: lmatlebyane
4 Replies

7. Shell Programming and Scripting

\n not working properly

Hi all, I'm trying to generate a series of txt files starting from a plain csv file part of my code: #!/bin/ksh INSTALLDIR=/Users/ME/Installdir CSV=CSV.csv TMP=/tmp/$(basename $0).txt tr -s "\r" "\n" < /$INSTALLDIR/$CSV > $TMP function Makefiles { printf '%24s:%30s\n' "sometext"... (1 Reply)
Discussion started by: Jive Spector
1 Replies

8. HP-UX

FC card not working properly

Hi I've a problem with Hp-ux 11.11 9000/800/rp3440 system. Already the software for driver & its patch are loaded for HBA Fibrechannel card, but still the fibrechannel card is showing the status "Unclaimed" . What will be reason for this? How to get the status "Claimed" ? Pl. help me out.... (4 Replies)
Discussion started by: Mike1234
4 Replies

9. UNIX for Dummies Questions & Answers

Cron won't run properly

I am new to unix, and this is my 1st post on this board. Looking for some advice about a cron job in my server. I am running a cron task that references a script which runs several other scripts and compiles them into a report and emails it to me. If I run the script manually, I will... (2 Replies)
Discussion started by: Steeler_fan
2 Replies

10. Programming

y is this not working properly?

#include <stdio.h> #include <sys/types.h> #include <string.h> #include <sys/stat.h> #include <unistd.h> struct stat s; main() { char c; if (fork()==0) { system("clear"); do { printf("myAI\\>§ "); scanf("%s",c); if(stat(c,&s)>-1) {... (3 Replies)
Discussion started by: C|[anti-trust]
3 Replies
Login or Register to Ask a Question