LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Closed Thread
  Search this Thread
Old 03-17-2006, 01:18 AM   #1
Rinish
Member
 
Registered: Apr 2005
Location: Bangalore
Distribution: Redhat, CentOS, AIX
Posts: 93

Rep: Reputation: 15
Seting cron for every second


HI All,
I wana set a cron to run a script every second. Please reply back if any one knows how to do this.

Thanks & regards,
 
Old 03-17-2006, 01:56 AM   #2
amitsharma_26
Member
 
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
Quote:
Originally Posted by Rinish
I wana set a cron to run a script every second.
What if your command dint got finished in 1 sec.. Wll the cron re-run the instance of it again in next sec & further on?

Leave that.

Cron only checks crontab enteries every minute.. & hence you cannot ask cron to process anything specified less to a minute. Hence cron cannot schedule anything to more minute* than a minute.

*small.

Refer cron/crontab man page.

Last edited by amitsharma_26; 03-17-2006 at 02:30 AM.
 
Old 03-17-2006, 03:46 AM   #3
doc.nice
Member
 
Registered: Oct 2004
Location: Germany
Distribution: Debian
Posts: 274

Rep: Reputation: 34
Lightbulb

maybe you could use this scritp running in background:
Code:
#!/bin/bash

###
### Sample background worker script
### for linuxquestions.org written
### by Florian Harbich (user doc.nice)
###
### Free for use or modification, even if
### useless in this variant... ;)
###

TERMINATORFILE="/var/run/backgroundworker.ctl"
GOON=1
while [ $GOON ]; do
  [ -f "$TERMINATORFILE" ] && GOON=0
  # do your repeated stuff instead of logger syslog sample here
  logger -t BGWorker --  "hi! I'm happy to tell you i'm still alive"
  sleep 1
done
rm -f "$TERMINATORFILE"
 
Old 03-25-2006, 08:45 AM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

http://www.linuxquestions.org/rules.php

Please continue here:
http://www.linuxquestions.org/questi...d.php?t=425623
 
  


Closed Thread


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Seting cron to run a script every second Rinish Programming 14 09-23-2010 03:48 AM
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 09:09 AM
Seting the IRQ maginotjr Slackware 9 10-03-2005 04:11 PM
Seting up KPPP Gomi Linux - Newbie 0 08-29-2004 11:48 PM
seting up a gateway 2new2linux Linux - Newbie 1 11-03-2000 11:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:46 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration