LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 06-28-2008, 09:01 AM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Rep: Reputation: 50
There is Sleep, Watch Packages but not : run for X minutes, then stop :(


There is Sleep, Watch Packages but not : run for X minutes, then stop
 
Old 06-28-2008, 09:38 AM   #2
jomen
Senior Member
 
Registered: May 2004
Location: Leipzig/Germany
Distribution: Arch
Posts: 1,684

Rep: Reputation: 54
What do you want to do?
 
Old 06-28-2008, 11:09 AM   #3
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware & Slackware64 14.1
Posts: 6,857
Blog Entries: 51

Rep: Reputation: Disabled
Think he wants to go jogging.
 
Old 06-28-2008, 11:56 AM   #4
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 50
Quote:
Originally Posted by brianL View Post
Think he wants to go jogging.
indeed
http://www.humanflow.de/images/jogging_man.jpg
can linux train me to run longer distances ?


No, something like:
Code:
runfor 10m 'xclock & audacious & '
or not cute alternative
Code:
xterm  -e  'xclock & audacious & '  & sleep 10m ; killall -e xterm
 
Old 06-28-2008, 12:10 PM   #5
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
Code:
#!/bin/bash

SLEEPTIME=$1
shift
(( SLEEPTIME *= 60 ))

# Run command, saving pid
"$@" &
PID=$$

# nighty night
sleep $SLEEPTIME

# die !
kill $PID

Last edited by Mr. C.; 06-28-2008 at 12:12 PM.
 
Old 06-28-2008, 12:18 PM   #6
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 50
Code:
$ ./runfor 10s 'xlock ; audacious '
./runfor: line 5: ((: 10s: value too great for base (error token is "10s")
./runfor: line 8: xlock ; audacious : command not found

Code:
/usr/bin$ cat runfor
#!/bin/bash

SLEEPTIME=$1
shift
(( SLEEPTIME *= 60 ))

# Run command, saving pid
"$@" &
PID=$$

# nighty night
sleep $SLEEPTIME

# die !
kill $PID
 
Old 06-28-2008, 12:29 PM   #7
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
I left the unit conversion as an exercise for the reader. Current implementation, enter the number of minutes.
 
Old 06-28-2008, 04:42 PM   #8
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,546

Original Poster
Rep: Reputation: 50
Quote:
Originally Posted by Mr. C. View Post
I left the unit conversion as an exercise for the reader. Current implementation, enter the number of minutes.
Would you think that doing :
Code:
runfor 60m "mplayer -vo null -vc dummy -dumpstream 'http://streaming.radionomy.com:8000/Retro-House-Belgium-' -dumpfile techno-radio-one-hour-only.mp3"
would work too?
 
Old 06-28-2008, 07:19 PM   #9
Mr. C.
Senior Member
 
Registered: Jun 2008
Posts: 2,529

Rep: Reputation: 59
Try it for 1 minute.

runfor 1 ....
 
Old 06-29-2008, 05:55 AM   #10
makuyl
Senior Member
 
Registered: Dec 2004
Location: Helsinki
Distribution: Debian Sid
Posts: 1,107

Rep: Reputation: 53
apt-get install timeout
timeout 60 mplayer -vo null -vc dummy -dumpstream 'http://streaming.radionomy.com:8000/Retro-House-Belgium-' \
-dumpfile techno-radio-one-hour-only.mp3
should run it for one minute
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A shell script that will wget for 30 minutes, then stop? Rotwang Linux - General 7 06-12-2008 02:28 AM
ftp transfert stop after 45 minutes numero7 Linux - Software 0 09-14-2007 06:56 AM
Screensaver restart my Mandriva Linux every 5 minutes. How to stop it? hansprawira Linux - Newbie 2 03-15-2007 05:27 PM
USB optical mouse cursor stop working after few minutes. DragonBall-Z Puppy 5 02-16-2007 11:31 PM
creating a stop watch in Linux C cynthia_thomas Programming 6 05-24-2006 03:22 AM


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

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 Google+: linuxquestions
Open Source Consulting | Domain Registration