Cron tab time generation script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cron tab time generation script
# 1  
Old 09-27-2013
Cron tab time generation script

Hi folks,

Everyone knows about crontab, what i am looking for a script where i will define hour,minute and day and it will generate crontab complete time entry, i have seen many website generating crontab entry and my question is that is there any shell script that can do same work.

Code:
20 09 * * 5 command

# 2  
Old 09-27-2013
Hello,
assuming three command line parameters as:
$cronscript.sh <hr> <min> <day>

the script would be:
Code:
HR=$1
MIN=$2
DAY=$3

crontab -l > cron_now
#add new cron into cron file
echo "$MIN $HR * * $DAY script-which-needs-to-be-added-to-cron" >> cron_now
#install the new cron_now file
crontab cron_now
#remove the temp cron_now file
rm cron_now


Last edited by inventsekar; 09-27-2013 at 06:51 AM..
# 3  
Old 09-27-2013
Hi,

I am talking about this, do we have some shell script like that?

http://www.thepcmanwebsite.com/crontab_generator.shtml
# 4  
Old 09-27-2013
Hi there,
yes, my script does that exactly.
ok, may i know exactly what you like to do. do you want to input the min, hr and day thru cmd line arg or thru reading from user? could you please provide more info..
# 5  
Old 09-27-2013
Quote:
Originally Posted by inventsekar
Hi there,
yes, my script does that exactly.
ok, may i know exactly what you like to do. do you want to input the min, hr and day thru cmd line arg or thru reading from user? could you please provide more info..
Thanks for your kind reply. Yes i want to input minute and hour and month, day of monday, day of week from command line, so it will show complete output.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Solaris

Solaris cron job email generation not required

Hi, How do we stop default cron job emails bein generated in Solaris 10? All our cron entries are ending with /dev/null 2>&1 but still emails are being generated. And all these emails are nuisance, as they are also get relayed to our local network sendmail MTA server (for system email... (14 Replies)
Discussion started by: hasan.kamali
14 Replies

2. Shell Programming and Scripting

Shell Script runs good manually but not through Cron tab

Hello Every one, I have a shell script which is running fine manually, but its giving me hard time when running tru cron job. :wall:. Am using #!/usr/bin/ksh >echo $SHELL /usr/bin/ksh Cron Job is as below, it execues but dosent do what i want it to do. 47 15 * * *... (1 Reply)
Discussion started by: naren.chowdhary
1 Replies

3. Programming

error in running script in cron tab

Hi I am running the following script in cron tab: #!/usr/local/bin/php <?php $handle=fopen('xmlfile.xml',"w"); $xmlfile= file_get_contents('http://diur-plus.2me.co.il/xml.aspx'); fwrite($handle,$xmlfile); fclose($handle); /* * To change this template, choose Tools |... (1 Reply)
Discussion started by: programAngel
1 Replies

4. UNIX for Dummies Questions & Answers

Cron tab script with parameters

hi, In a cron tab, can the command to be executed contain parametrs for the script too? E.g: ******* ./script.sh file fil2 > /dev/null Is the above valid one? Thanks You have 37 posts - you should know how and when to use code tags. You got a PM with instructions. (1 Reply)
Discussion started by: pandeesh
1 Replies

5. Shell Programming and Scripting

Cron tab

Hi, We have a couple of jobs are scheduled in CRONTAB. Now. I want generate a report for each job how many times ran successful and failed in a 1 month of time period. is there any way to find in CRONTAB. Please advise on this. (1 Reply)
Discussion started by: koti_rama
1 Replies

6. Shell Programming and Scripting

Different time format in script, started in shell or in cron

I try to write a python script, which analyze user logon time with "who" command. When i start script in bash, i get this result: USER=mnadmin tty7 2009-04-18 11:37 (:0) But when i start script in cron, i get result like this: USER=mnadmin tty7 Apr 18 11:37 (:0) I see -... (2 Replies)
Discussion started by: jrush
2 Replies

7. UNIX for Dummies Questions & Answers

Cron Tab help

Hi All I have a requirement to schedule my script through cron tab. I have 2 scripts to schedule. Case1:My script should run every day in the server.It should be triggered in every 2 mins interval.i.e suppose i implemented the script now my script should run every 2 mins.How can i... (6 Replies)
Discussion started by: dr46014
6 Replies

8. Shell Programming and Scripting

Script to run 100jobs at a time from cron

here is my requirement. When ever the customer visitis the sore we want to look his information by his phone no. From the database side we are putting all the information in session pools. for example if we have 500 stores and at any second one customer is at the counter we can get atlease 500... (2 Replies)
Discussion started by: skneeli
2 Replies

9. Shell Programming and Scripting

Cron tab help need

need help to write crontab my crontabe file every minute to rsh and check that it is running or not i want to change it on every 1o minute please help me example of my crontab #check if system is running * * * * * rsh metal3 /users/test/run.server i want to check that every 10... (2 Replies)
Discussion started by: deepa20
2 Replies

10. UNIX for Advanced & Expert Users

cron tab commands

Hello: If I want to run a crontab every hour between 9 am to 9pm, will this work 00 09-19 * * * /.../.../../program.sh If the above does not work, what should it be ?? Thanks, ST2000 (4 Replies)
Discussion started by: ST2000
4 Replies
Login or Register to Ask a Question