Cron won't run properly


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Cron won't run properly
# 1  
Old 08-30-2006
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 receive the whole report, but when it runs through cron, it will run successfully, but the report is incomplete.

I keep thinking that there is a permission issue somewhere, but I am unsure. Any suggestions?
# 2  
Old 08-30-2006
This is a very common issue. A script run in cron does not take the user environment into consideration, i.e., paths, shell, etc. You need to go back to your main script and all the others referenced in the main script and make sure that shells and paths to commands are declared.

BTW, you can do a search in this forums. You will be able to find more details on this, and a lot of other common questions.
# 3  
Old 08-31-2006
The directory information seems fine, because like I said when I run it manually the whole report is completing. But the shell may be a problem.

In the crontab, the task designates "csh -c" but then in the beginning of the other scripts, it does not designate which shell is being used.

How would I do that in the script? should I add a line "!/bin/csh" ?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Bash script won't run because hardware won't produce display

Can anyone offer any advice on how to modify the script below to work on a new system we have, that has no graphics capability? We admin the system through a serial RAS device. I've tried running the below script through the RAS and through an ssh -X session. It failed with something like "GTK... (3 Replies)
Discussion started by: yelirt5
3 Replies

2. Shell Programming and Scripting

Script fails to run properly when run from CRONTAB

Hello all, I'm trying to write a script to gather and send data and it works just fine at the bash command line, but when executing from CRON, it does not run properly. My scripting skills are pretty limited and there's probably a better way, but as I said it works at the command line, but... (12 Replies)
Discussion started by: rusman
12 Replies

3. Shell Programming and Scripting

Cron won't restart rsyslog

Howdy, I am nearly tearing my hair out as Cron isn't running a script that should work. I am interning for a company. Their rsyslog keeps track of traffic that gets past a firewall. It creates two files called pix.log and pix2.log. Every time something happens with the firewall, it adds to... (11 Replies)
Discussion started by: sstrahm001
11 Replies

4. Shell Programming and Scripting

Script does not run properly

Hello everybody Im learning bash scrpting language and im making a script that read a file line by line and it does a comparison if in a line start with a letter or number and it will delete every ones that start with a letter. But im getting some errors First of all, this is the script's... (5 Replies)
Discussion started by: alienrunes
5 Replies

5. OS X (Apple)

gftp won't launch properly after installing using darwinports

Hello, I installed gftp using darwinports on Snow Leopard. Install appeared to go fine with no errors. When trying to launch gftp by starting X11, then typing /opt/local/bin/gftp in the terminal, nothing happens until about 30 minutes later when only a partial window appears. I get the... (0 Replies)
Discussion started by: Allasso
0 Replies

6. Shell Programming and Scripting

Script not running properly when run from Crontab

Hi I am a novice Linux/Perl user and am struggling to overcome what I am sure is a simple problem. I am using a perl program to create a shell script daily containing between 10 and 30 "at -f" commands for the same day. Then I change the file attributes to allow the file to be executed. When... (2 Replies)
Discussion started by: simoncjones
2 Replies

7. 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

8. HP-UX

Cron - Not working properly

Hi, I do have three scripts. Whcih inserts records into a table using sqlldr, creating some reprot files etc. The first script will call the second and then the second will call the third. When I run my first script from the shell prompt, all my operation are completed successfully. If I do... (23 Replies)
Discussion started by: risshanth
23 Replies

9. UNIX for Dummies Questions & Answers

Simple cron job won't work

I have a script in a directory -say users/me/test/ It looks like this: # "bkup" - copies specified files to the user's ~/Backup # directory after checking for name conflicts. a=$(date +%T) cp $1 ~/test/Backup/$1.$a It copies file.txt from current directory and timestamps the name of it of... (4 Replies)
Discussion started by: coregan
4 Replies

10. UNIX for Dummies Questions & Answers

Why won't my script run?

On the following script that I get an error when I try to execute as root: #./mv_log.sh bash: /root/util/mv_log.sh: Permission denied #!/usr/bin datetag=`date --date='1 day ago' +"%b%d%Y"` logname=`find /opt/bea/wlserver6.1/config/*/logs/ -iname 'access.log0*' -mtime -1 -print` mv... (4 Replies)
Discussion started by: darthur
4 Replies
Login or Register to Ask a Question