LinuxQuestions.org
Support LQ: Use code LQCO20 and save 20% on CrossOver Office
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 12-23-2005, 12:48 PM   #1
rahulrawat
LQ Newbie
 
Registered: Dec 2005
Posts: 16

Rep: Reputation: 0
Question how to run a schedule in every 2 mins!!


Hi!! i m trying to run a schedule in such a manner that it will run in every 2 mins and the schedule should be listed in the terminal...

I really need help , So plz help me out!!! i really waiting for your response!!!
 
Old 12-23-2005, 01:17 PM   #2
tsphan
Member
 
Registered: Jan 2005
Location: Clackamas, Oregon, US
Distribution: Slackware 10.2
Posts: 154

Rep: Reputation: 30
all you have to do is set up your crontab, if you want it to run as root, load up a terminal session as root and type in "crontab -e"

all information on setting it up can be found in "man crontab"

if i were you, i'd set up the entry as:

*/2 * * * * /your/command/you/are/trying/to/run/bin/command > /dev/pts/#

replace the /your/command/you/are/trying/to/run/bin/command as the command you're trying to run
then set the /dev/pts/# to the terminal you're trying to send it to, or /dev/tty# if you want it in a Virtual Terminal
 
Old 12-23-2005, 05:44 PM   #3
rahulrawat
LQ Newbie
 
Registered: Dec 2005
Posts: 16

Original Poster
Rep: Reputation: 0
Question

Thanks tsphan!!!

I really thankful to you, However i have tried what you said but it's not working (Actually i m new to linux ), I let you know that what i m doing and tell me whether i m doing correctly or not?

I have created a file named as "test" on tty1

Made entry as u suggested

*/2 * * * * /bin/ls > /dev/tty2

saved file

on root prompt typed

root@tty1#crontab test

checked on tty2.

logged in and there was no mail on tty2.

Waiting for your next respond!!! Thanks once again.
 
Old 12-23-2005, 06:49 PM   #4
tsphan
Member
 
Registered: Jan 2005
Location: Clackamas, Oregon, US
Distribution: Slackware 10.2
Posts: 154

Rep: Reputation: 30
crontab is actually just a program to edit your cron settings. The real power is in crond, most distros have this running in the beginning, but you should double check with your settings to make sure it's running at start up.

What crond will do is read your crontab settings and runs the program according to how the crontab was setted up.

So once you've configured it, as root, you should reset your crond with "killall crond" then run "crond", it'll automatically load itself into the background and that should do it.
 
Old 12-24-2005, 09:47 AM   #5
rahulrawat
LQ Newbie
 
Registered: Dec 2005
Posts: 16

Original Poster
Rep: Reputation: 0
Question

Thanks tsphan!!!

finally its working buddy!!! But sir, it's displaying the ls -l for /root not for /bin...
i put the script:-

*/2 * * * * /bin/ls -l > /dev/tty2

Waiting for your next respond!!! Thanks.
 
Old 12-24-2005, 01:02 PM   #6
tsphan
Member
 
Registered: Jan 2005
Location: Clackamas, Oregon, US
Distribution: Slackware 10.2
Posts: 154

Rep: Reputation: 30
hurray, it works!
to make it list the bin directory, simply change the command to:
Code:
/bin/ls -l /bin > /dev/tty2
 
Old 12-24-2005, 04:53 PM   #7
rahulrawat
LQ Newbie
 
Registered: Dec 2005
Posts: 16

Original Poster
Rep: Reputation: 0
Thumbs up

You know Buddy You are genius !!!

You have fixed my problem completly !!!

I had made one change, it started working perfectly.

changes were:-

Code:
ls -l /bin > /dev/tty2
I remove the /bin from the starting and putted in the end and it's started working...

Sir, in future if any problem can i directly mail it to you!!! my email id is rahulrawat@hotmail.com
 
Old 12-24-2005, 06:58 PM   #8
tsphan
Member
 
Registered: Jan 2005
Location: Clackamas, Oregon, US
Distribution: Slackware 10.2
Posts: 154

Rep: Reputation: 30
congratuatations on getting it working!

the best place to always ask your Linux questions is here in my opinion

if you really feel like i could help, sure, feel free to email me anytime, but i suggest LinuxQuestions first cause it helped me with all of my previous questions
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
|Keyboard locks after 15 mins Stimz Linux - Hardware 2 08-29-2005 03:23 AM
Mandrake 10.1 takes 5 mins to log in mat_uk111 Mandriva 4 01-22-2005 03:51 AM
FC3 freezing after 3-5 mins of use dual_core Linux - Newbie 2 11-21-2004 09:14 AM
About 15 mins. from dumping Linux... wonderboy1999 Mandriva 10 08-31-2004 12:00 AM
how to set cron job to run every 5 mins? gsbarry Linux - General 7 05-28-2003 12:30 PM


All times are GMT -5. The time now is 09:06 AM.

Main Menu
 
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: @linuxquestions
Open Source Consulting | Domain Registration