Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 05-15-2002, 03:32 PM   #1 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
crontab!

this project i'm working on tody is teaching me a lot .. i got perl 5x installed and everything is working great ..

now i need to setup a cron job to run once per minute.

i navigate to my cron directory: /var/spool/cron

then i try to edit the file: vi cron

i have it opened in vi , but the problem is that as soon as i try to add my line, i can not.. i puts up some other info as soon as i try to type anything.

is there a proper way to do this? i checked.. and i don't think there are any NUMS on cron jobs
sde is offline   Reply With Quote
Old 05-15-2002, 04:16 PM   #2 (permalink)
revolution
Legend in my own mind
 
revolution's Avatar
 
Join Date: May 2002
Location: florida
Posts: 618
revolution is on a distinguished road
Send a message via AIM to revolution
are you using i for insert into vi? ESC should get you back to command mode
__________________
Is it me or does the word abbreviation seem a little long?


registered user #193524 with the Linux Counter,
http://counter.li.org
revolution is offline   Reply With Quote
Old 05-15-2002, 05:14 PM   #3 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
You don't edit the cron file directly, you use the command

'crontab -e'

This command edits the default systemwide cron file, if you want to edit a specific user's file, you can use

'crontab -u $USER -e'

..obviously substituting $USER for the username you want to use. If you want to edit a file by hand and have it become part of your cron, just point cron at it with the

'crontab filename'

command. This is what I do, I keep a personal .crontab file in my home directory and just run 'crontab ~/.crontab'. Enjoy!
bdl is offline   Reply With Quote
Old 05-15-2002, 06:03 PM   #4 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
thanks b, .. but where do i set the time then?

i have a perl script named "status" that i need to execute once per minute.

crontab -e status 1 * * *

?? does that seem right?
sde is offline   Reply With Quote
Old 05-15-2002, 06:53 PM   #5 (permalink)
bdl
Senior Contributor
 
Join Date: May 2002
Location: vta.ca.usa
Posts: 555
bdl is on a distinguished road
Quote:
Originally posted by mmilano
thanks b, .. but where do i set the time then?

i have a perl script named "status" that i need to execute once per minute.

crontab -e status 1 * * *

?? does that seem right?
No, whatcha do it edit the file in a certain way so that it executes commands based on your time settings. So use 'crontab -e' and then edit the file by hand. Her's an example to help you out.

Code:
# example crontab #

# time is listed as: minute, hour, day of month, month, day of week #

# min hr dom mon dow #   # execute #

# entry will run the executable once an hour #

0 0-23/1 * * * exec /path/to/executable  

# entry will run the executable once a minute #

0-59/1 * * * * exec /path/to/executable

# eof #
Here's a quick link I found on google that may help.
bdl is offline   Reply With Quote
Old 05-16-2002, 06:28 AM   #6 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,475
sde is on a distinguished road
Thanks BDL! Everything works great now!
sde is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
CLI for noobies: stay regular with cron and crontab sde Code Newbie News 1 04-05-2004 05:24 PM
Crontab Belisarius Linux / BSD / OS X 1 02-16-2004 02:59 PM


All times are GMT -8. The time now is 11:07 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting