Schedule the Script


 
Thread Tools Search this Thread
# 1  
Schedule the Script

I have wriiten one script to get some results from log files. Daily I have to run the script using the below command to get the output.

What I need is, Can I schedule the Script to execute once every day at a particular Time and get the output by mail automatically? I heard about 'cron job' . . But I am not aware of it. I just started learning scripting.

It will be helpfull, If anyone give the Sample script to do this.

Thanks in advance.
# 2  
look at the man pages of crontab...
Create you crontab file using vi, save it and give it a try:
Code:
crontab  my_crontabfile

Ah, you need to have the right to use cron, so reading the manpages of cron cannot harm...
# 3  
I had a similar requirement at work and this is what I did:
1. A script that fetches results form log file and writes the output to a file (say log_output.dat).
2. In the same script, write a line of code at the end, to email the contents of log_output.dat to yourself (learn how to use the mailx command)
3. Edit the file /etc/crontab (you may need to have permission to do this on your linux distribution) and add a cron job to run this script at required time (learn how to use cron)
This User Gave Thanks to balajesuri For This Post:
# 4  
We. to be more useful after need to know your OS ( and version).
 

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

Test Your Knowledge in Computers #815
Difficulty: Medium
In CSS, E[foo] matches an E element with a 'foo' class name.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Want to Schedule Shell Script on AIX

Hi All, I want to schedule a shell script on AIX. But Crontab is not working in my AIX Server.Is there any alternative? Please Suggest.. (2 Replies)
Discussion started by: bharat1211
2 Replies

2. Shell Programming and Scripting

Schedule tasks in shell script

shell=ksh, How could I schedule tasks in shell script INSTEAD OF using the crontab -e functionality? For example, I want a script to print "Hello World" every 10 seconds (i.e., INTERVAL = 10s) until external termination signal is triggered. Thanks, (2 Replies)
Discussion started by: isaacniu
2 Replies

3. Shell Programming and Scripting

Shell script to schedule jobs

Dear all, I have to create a shell script which will run the job during weekday/weekend in following manner: - There are 3 jobs JB_1 JB_2 JB_3 These jobs changes its flag to "COMPLETED" in below 2 ways 1. These 3 jobs which runs after the completion of previous one i.e JB_1 runs and... (5 Replies)
Discussion started by: prajaktaraut
5 Replies

4. UNIX for Dummies Questions & Answers

Best way to schedule script to run Ubuntu 10.04

On Ubuntu 10.04 LTS, I would like to know the best way to schedule myscript.sh to run at a specified time, please provide examples and specify things like does cron have to be running, how do I check if cron is running and all that. I have tried unsuccessfully in the past to run the AT command,... (1 Reply)
Discussion started by: glev2005
1 Replies

5. Shell Programming and Scripting

How to schedule a script in crontab.

Hi, My script is in $home/bin/sample.sh. I want to run the script for 3times a day, first execution will be at 08:00 am. second execution will be at 16:00 pm third will be at 23:59 pm. what will be the entry with this requirement?? (1 Reply)
Discussion started by: shrima.pratima
1 Replies

6. Shell Programming and Scripting

How to schedule my script without crontab

I have a script which shoud run after every 30 minutes.Though I know abt crontab, unfortunately I dont have access/authorization to use crontab in my terminal. Could any one pls let me know how to schedule the script without crontab ? Regards Prashant:) (3 Replies)
Discussion started by: prashant43
3 Replies

7. Shell Programming and Scripting

Schedule an interactive shell script

Hi, I need to schedule a shell script which executes another shell script along with a series of other commands. When the inner shell script is executed it prompts for a password..... This inner shell cannot be changed How can I do this???? Regards, Chaitrali. (4 Replies)
Discussion started by: Chaitrali
4 Replies

8. Shell Programming and Scripting

Script Schedule Scrutiny

Hi All, Here's one that may belong in the Scripting Thread but I thought I'd start off here. Here's the scenario:- I have to transfer the functionality and data from an old E450 to a nice new Sun V440. The E450 contains a bunch of scripts which may or may not still be in use daily,... (2 Replies)
Discussion started by: geralex2
2 Replies

9. Shell Programming and Scripting

Schedule a script to check mail?

Hi, I'd like to somehow schedule a task on my webserver, such that my account's mail is checked every 10-15 minutes and: a) any new e-mails received from a particular address are POST-ed to a PHP webpage on my server. b) any new e-mails received from a different particular address are... (2 Replies)
Discussion started by: stujones
2 Replies

10. Shell Programming and Scripting

How can I schedule a script on Solaris?

How can I schedule a script on Solaris? (3 Replies)
Discussion started by: krikets
3 Replies

Featured Tech Videos