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


Closed Thread
  Search this Thread
Old 03-17-2006, 01:18 AM   #1
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
Registered: Sep 2005
Location: New delhi
Distribution: RHEL 3.0/4.0
Posts: 777

Rep: Reputation: 31
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.


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
Registered: Oct 2004
Location: Germany
Distribution: Debian
Posts: 274

Rep: Reputation: 34

maybe you could use this scritp running in background:

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

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
Old 03-25-2006, 08:45 AM   #4
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.

Please continue here:

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 > Forums > Linux Forums > Linux - Networking

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

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