The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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 05:08 AM
Pro*C Update not working from Crontab alhallay UNIX for Advanced & Expert Users 2 09-16-2007 12:25 AM
crontab NOT working baanprog UNIX for Advanced & Expert Users 2 09-26-2006 12:11 PM
crontab command not working digant UNIX for Advanced & Expert Users 8 01-04-2004 09:46 PM
crontab not working right kymberm UNIX for Dummies Questions & Answers 3 07-09-2003 04:21 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 01-31-2003
ezekiel61 ezekiel61 is offline
Registered User
  
 

Join Date: Feb 2002
Location: HELLena, MT
Posts: 14
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
  #2 (permalink)  
Old 01-31-2003
TioTony's Avatar
TioTony TioTony is offline Forum Advisor  
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
Erwin Stocker Erwin Stocker is offline
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:53 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0