how to run a Script automatically


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers how to run a Script automatically
# 1  
Old 10-17-2006
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
# 2  
Old 10-17-2006
# 3  
Old 10-17-2006
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.
# 4  
Old 10-17-2006
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..
# 5  
Old 10-18-2006
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
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run a script before and after reboot automatically and send output to two locations.

Hello Team . I am working a health check script ( bash) to run on linux server ( RedHat) and requirements are 1. The o/p of script need to be send to two diff files . I am testing with tee command . But I am not successful yet , any recommendations if that is the right approach ? 2. The same... (2 Replies)
Discussion started by: Varja
2 Replies

2. Shell Programming and Scripting

How to run script automatically every 12 hour once?

Hi ! all, I have once script to remove temporary cache and temporary xml files looks like this, as it is taking more space, I would like to run automatically every 12 hour once, and then I want to receive some log as acknowledgement #!/bin/sh echo "Removing logs and temp files (typically... (4 Replies)
Discussion started by: Akshay Hegde
4 Replies

3. Shell Programming and Scripting

How to run script automatically on reboot as root user?

Hi friends,,, I am running one server on Ubuntu 12.04 LTS 32-bit, some times my pc restarts automatically, with no reason, I have a script to start server which requires root password. in this directory /myserver/start_server.sh How can I do this ? and some scripts I am having that I... (1 Reply)
Discussion started by: Akshay Hegde
1 Replies

4. AIX

How to run a script automatically when AIX version 7 server reboots?

Am new to AIX please help me. I have AIX7 server. When ever the system reboots my script need to run automatically. This will help me to start my application automatically after the server reboot. Thanks, Prince Wells (9 Replies)
Discussion started by: prince1987
9 Replies

5. Shell Programming and Scripting

variable has no value if run the script automatically/scheduled

Hi All, I am using ksh as the shell. I have a script that should store variable after executing "onstat" on informix. I can execute it successfully without any issue if run manually, however the value is not showing up when run automatically(scheduled). Is there anything needed to make the... (1 Reply)
Discussion started by: tungaw2004
1 Replies

6. Shell Programming and Scripting

How to run a script automatically

Hi All, How can i run a script every week automatically. Thanks & regards, Sam (5 Replies)
Discussion started by: sam25
5 Replies

7. Shell Programming and Scripting

Automatically run bash script

Hi! I want to run/execute a bash script automatically everytime when a specific file is created or when its timestamp changes. Is this possible? How? Thank you very much for your answers in advance, Regards, Christoph (1 Reply)
Discussion started by: ckofler
1 Replies

8. Shell Programming and Scripting

how to run shell script automatically

hi , i m trying to run bash scrip automaticially but i dont know how i can do this an anybody tell me how i can autorun shell script when i logon . thanks (9 Replies)
Discussion started by: tahir23
9 Replies

9. UNIX for Dummies Questions & Answers

How to run a script automatically ?????

Hi All, How to run a script automatically using cronjob everyday from Monday to Friday 9A.M to 5P.M at an interval of ONE HOUR.I want the complete syntax means how to put in the cron job and there after. URGENTLY NEED HELP THANKS IN ADVANCE CHEERS Arunava (7 Replies)
Discussion started by: arunava_maity
7 Replies
Login or Register to Ask a Question