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
i want a script to execute if the time is 12:00 automatically lakshmananindia UNIX for Advanced & Expert Users 2 09-04-2007 01:22 PM
Can we launch a shell script automatically upon ssh login? rockysfr UNIX for Advanced & Expert Users 1 07-02-2007 07:48 PM
Script to automatically change password. rahulrathod Shell Programming and Scripting 1 10-04-2004 05:33 AM
Script to find PID and kill automatically ST2000 Shell Programming and Scripting 4 08-01-2002 07:38 AM
How to run a script automatically ????? arunava_maity UNIX for Dummies Questions & Answers 7 05-02-2001 07:37 PM

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-17-2006
Registered User
 

Join Date: Oct 2006
Posts: 7
how to run a Script automatically

How to make a script run automatically using a cron??

i do not know abt cron......

if i have simple.sh file and i need this to run everyday at a particular time what needs to be done


thanks in advance
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 10-17-2006
Glenn Arndt's Avatar
Anomalous Lurker
 

Join Date: Feb 2006
Location: Indianapolis, IN
Posts: 255
See this link: cron and crontab
Reply With Quote
  #3 (permalink)  
Old 10-17-2006
Registered User
 

Join Date: Aug 2005
Location: Saskatchewan
Posts: 923
You can edit your own cron table with 'crontab -e'.

For information on the contents of your cron table, see 'man 5 crontab'. If you do not have this manpage, see here.
Reply With Quote
  #4 (permalink)  
Old 10-17-2006
Registered User
 

Join Date: Oct 2006
Location: India
Posts: 4
u can do it either the crontab way or just add pur ur .sh file in rc.d folder under /
then ur .sh file will be processed every time ur system boots up..
Reply With Quote
  #5 (permalink)  
Old 10-18-2006
Registered User
 

Join Date: Oct 2006
Location: NewYork
Posts: 21
Cron Jobs Usage
=================================================

1. Create a Script that you want to run as a CronJob

2. Assign the Script for the CRONTAB
(CRONTAB would be differ from each user. So if you want to create
a tab for the other user log-on as that user)
crontab -e ==> Command to edit the crontab
-e (edit user's crontab)
-l (list user's crontab)
-r (delete user's crontab)

3. Crontab Syntax:
crontab [ -u user ] file

<MIN> <HOUR> <DAY_OF_WEEK> <MONTH> <YEAR> <SCRIPT_NAME>

4. Examples

30 9-17 * 1 sun,wed,sat echo `date` >> /date.file 2>&1
At half past the hour, between 9 AM and 5 PM, for every day of January
which is Sunday, Wednesday or Saturday, append date to file date.file

0 23-7/2,8 * * * date
Every two hours from 11p.m. to 7a.m., and at 8a.m.

0 4 1 jan * date
4:00 a.m. on january 1st

To take the physical database backup every day:
15 23 * * * /home/z755692/scripts/makeDbBackup.sh >> /tmp/DBBACKUP/bkup.log


Reference:
==========
http://www.pantz.org/os/linux/programs/cron.shtml
Reply With Quote
Google UNIX.COM
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 08:44 AM.


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