Question regarding the cron


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Question regarding the cron
# 1  
Old 03-24-2010
Question Question regarding the cron

Hi,

We have developed the script which will send an (html)attachment in through mail. The stand alone script is working fine ,but when we schedule it cron the "nail" command is not working that is we are not receving any mail.
Following is the command which we used to send the mail. Smilie

HTML Code:
/usr/bin/nail -s "Reports generation mail" -a Units.html -a Hundreds.html abc@xyz.com < /dev/null
In the cron the script is schedule everyday. Following is the cron entry:

HTML Code:
00 09 *  *  * /home/admt/common/script/Report_generation.ksh >> /home/data/dev2/log/Report.log
Why the "nail" command is not working in cron... Smilie
I also tried to use "mailx" command but its also not working.. Smilie
Can anybody help me regarding the same??

Thanks In Advance!!
# 2  
Old 03-24-2010
If the script is working when you, you execute it, that means you have something more in your environment cron is missing...
Have you tried to schedule under your own account? I would give a try and add as first line to the script
Code:
. $HOME/.profile

and see if it works now ($HOME may need to be substituted to the proper value...)
# 3  
Old 03-24-2010
The answer is always always the same: something not set in ENV.

If you think it really is cron, see Cron is not working

Otherwise, a very easy test is to try it with "at". If that works, it's absolutely an environment variable not set in cron. See Cron, Batch and At for suggestions on fixing that.
# 4  
Old 03-24-2010
Quote:
/home/admt/common/script/Report_generation.ksh
As a minimum this script will need a "cd" to wherever the files "Units.html" and "Hundreds.html" reside.

When you say "not working" please post any error messages. In this case the error messages will be in the unix mail for the account who owns the cron.


Personally I would take all processing out of cron totally (including >> redirection) and do the whole lot in the shell script under a controlled environment with a shebang line at the start of the script. Obviously still invoking the shell script from cron.

Last edited by methyl; 03-24-2010 at 12:50 PM.. Reason: spellin & more
# 5  
Old 03-24-2010
Computer

Thanks all for the reply!!!

Actually I just included the "vbe" command in the script and it worked.. Smilie Smilie

HTML Code:
. $HOME/.profile
Thanks again !! Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Cron job question

Hi, I have a cron job that I want to run twice a week, on Tues/Thurs, and I want it to run three times - specifically at 10pm, 11:10pm, and 12:20am respectively. I "think" the way to do this is to run the following: 00,10,20 22,23,00 * * 2,4 MYCOMMAND Just wanted to verify this... (4 Replies)
Discussion started by: xdawg
4 Replies

2. Linux

Question about cron jobs

with the cron format * * * * * | | | | | | | | | | | | | | | +---- Day of the Week (range: 1-7, 1 standing for Monday) | | | +------ Month of the Year (range: 1-12) | | +-------- Day of the Month (range: 1-31) | +---------- Hour (range: 0-23) +------------ Minute ... (1 Reply)
Discussion started by: buyog
1 Replies

3. Shell Programming and Scripting

cron question

folks; This might sounds stupid, but i tried few ways to solve it without luck. I need to run a job on the first Saturday of every month at 10 pm. so far i'm not sure what am i doing wrong, but every time i set it, it always run every Saturday instead of the first Saturday of every month. Any... (4 Replies)
Discussion started by: moe2266
4 Replies

4. Shell Programming and Scripting

cron question

Folks; I have this script in SUN which if i run it using command line, it works fine, but when i run it using cron, it work but it misses one thing. here's the details #!/bin/bash cd /opt/new_script for i in ./report*Groups.sh; do $i $1; done This script above when runs through cron, it... (4 Replies)
Discussion started by: moe2266
4 Replies

5. Solaris

Solaris 10 cron question

I have a script that needs to install a script the runs just before cron starts. Currently (for 9 and older), it simply finds the name of the cron script in /etc/rc?.d, decrements the number and creates a link. For example, if cron starts with /etc/rc2.d/S75cron, the install script extracts the... (3 Replies)
Discussion started by: BOFH
3 Replies

6. UNIX for Dummies Questions & Answers

question about cron

I have a script which goes out and installs a package on a box remotely and im trying to get it to add a cron job too..but im having a few problems, whilst it does add the entry it wont run unless I connect to the machine , crontab -e, then :wq. This re-reads the configuration file and it will now... (1 Reply)
Discussion started by: hcclnoodles
1 Replies

7. AIX

CRON Question

Could someone please tell me how I might specify in cron that I want a job to run only on the "last saturday" of the month? Thanks. (2 Replies)
Discussion started by: DenD
2 Replies

8. Shell Programming and Scripting

cron question

I'm new to cron, What does this syntax mean? 0 5 * * 1-5 /u08/0ra33/run_arch.sh thanks (2 Replies)
Discussion started by: ted
2 Replies

9. Shell Programming and Scripting

Cron Script Question

A co-worker is having trouble w/ a job scheduled from cron and I got involved. Unfortunately I couldn't seem to find the answer and need some help. First off, I'm pretty sure he's using redhat linux. Anyway, I want to schedule a cronjob to run a java class. Let's say that, logged in as root, I... (3 Replies)
Discussion started by: doublek321
3 Replies

10. UNIX for Dummies Questions & Answers

Question about Cron jobs?

I can see where the nohup command can come in very handy. My question is, do you have to do something like this (nohup) in order to run certain cron jobs? On the windows side, I have a couple of scripts that basically run continuously, so all I have to do is ctrl-alt-del to lock my workstation,... (2 Replies)
Discussion started by: wmosley2
2 Replies
Login or Register to Ask a Question