The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
crontab-nmon not working fara_aris AIX 5 06-03-2008 02:08 AM
Pro*C Update not working from Crontab alhallay UNIX for Advanced & Expert Users 2 09-15-2007 09:25 PM
crontab NOT working baanprog UNIX for Advanced & Expert Users 2 09-26-2006 09:11 AM
crontab command not working digant UNIX for Advanced & Expert Users 8 01-04-2004 05:46 PM
crontab not working right kymberm UNIX for Dummies Questions & Answers 3 07-09-2003 01:21 PM

Closed Thread
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-31-2003
Registered User
 

Join Date: Feb 2002
Location: HELLena, MT
Posts: 13
cron/crontab not working

Hello All!

I'm having problems with cron. First cron is running as a process when i send the top command and I am logged in as root. I type crontab -e to edit/create my cron job. What I'm trying to do is run a perl script on my server (the script does work, i know because I type perl script.pl and it runs). Here is an example of my crontab:

20 * * * * perl /var/dir/script.pl | cat update.email >> mail ed@ed.com

So if I understand cron right, every 20 minutes my scripts.pl will be executed by perl then an email will be sent to my email address with the contents of the update.email file. This is not happening though. The script is not executing and I am not getting emails to confirm it. Any suggestions are welcome. thanks!

Ed
__________________
g_M_e
Forum Sponsor
  #2 (permalink)  
Old 01-31-2003
TioTony's Avatar
Bit Pusher
 

Join Date: Oct 2001
Location: Southern California
Posts: 332
Hi Ed,
A few quick pointers should get you going in the right direction.

First, your cron job will run at 20 after the hour and only once per hour. If you want to run it every 20 minutes you should have a cron entry like this:

0,20,40 * * * * perl blah blah blah

This will run at the top of the hour, 20 after, and 40 after.

Second, your script is running but is directing the output of cat to a file called 'mail'. Try running 'perl /var/dir/script.pl | cat update.email >> mail ed@ed.com' from command line. I don't think you will get the results you want.

I think a better approach would be to put the 'cat' and 'mail' commands in your perl script or write a ksh/csh/sh/bash/etc wrapper script that first runs the script.pl and then 'mail ed@ed.com<<update.email'. Notice the mail syntax change. This will e-mail you the file where your previous command was basically creating a copy of upate.email called mail.
  #3 (permalink)  
Old 02-05-2003
Registered User
 

Join Date: Sep 2001
Location: MUC
Posts: 10
Thumbs up

Hi Ed,

a good solution is the following script .
You dont need the crontab.

while true

do

ksh all20minute.sh >/dev/null (or blablabla mail bla)

sleep 1200

done



greatings
Erwin
Google UNIX.COM
Closed Thread

Thread Tools
Display Modes




All times are GMT -7. The time now is 01:33 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0