LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 05-28-2006, 03:36 PM   #1
anjanesh
Member
 
Registered: Sep 2004
Location: Navi Mumbai
Distribution: Ubuntu 12.04 64-bit
Posts: 230

Rep: Reputation: 30
Running a command after a delay of n secs


Hi

Is there a command which will run a command I specify (this latter command will be the argument in the former one) after n seconds ?

Something like runlater "ls -l", 10

Thanks
 
Old 05-28-2006, 03:40 PM   #2
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
'sleep n && ls -l' should do the trick. 'man sleep' for a full list of options.

regards,
...drkstr

Last edited by drkstr; 05-28-2006 at 03:57 PM.
 
Old 05-28-2006, 03:46 PM   #3
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 70
What's wrong with the sleep command?

Example:
Code:
sleep 10 && ls -l
 
Old 05-28-2006, 04:28 PM   #4
anjanesh
Member
 
Registered: Sep 2004
Location: Navi Mumbai
Distribution: Ubuntu 12.04 64-bit
Posts: 230

Original Poster
Rep: Reputation: 30
Oh...didnt know we could have && in shell - thanks.
So if I wanted a php script to execute after 10 secs,
sleep 10 && php path/scrtip.php will work ?
 
Old 05-28-2006, 05:41 PM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729Reputation: 729
Or you can use "at"
 
Old 05-28-2006, 06:00 PM   #6
drkstr
Senior Member
 
Registered: Feb 2006
Location: Seattle, WA: USA
Distribution: Slackware 11.0
Posts: 1,191

Rep: Reputation: 45
Yup, you are just telling it to run the next command after the first one finishes. You can do as many as you want. I use it when I compile my kernel so I can just type one command and walk away until it finishes.

regards,
...drkstr
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to change telnet login timeout of 60 secs gimp123 Linux - Software 3 10-24-2011 02:52 PM
how-to: repeat OR iterate shell OR bash command delay OR interval admarshall Linux - General 5 07-18-2005 11:47 PM
disconnected after x secs: turn this off? grasland Linux - Networking 1 06-29-2004 02:48 AM
Process start delay when network running andrewb758 Linux - Software 1 02-16-2004 12:01 PM
Slackware 9 rebooting after 15-20 secs chakotay Slackware 4 03-26-2003 10:00 AM


All times are GMT -5. The time now is 11:27 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration