On Sun, 14 May 2017 22:47:09 +0200 Istvan Gabor wrote:
On Sun, 14 May 2017 16:27:31 -0400, Patrick Shanahan wrote:
* Istvan Gabor <suseuser04@gmail.hu> [05-14-17 15:32]:
Hello:
I would like to use cron to start and stop wget commands using wget -q (quiet) and -b (background) options. For stopping the correct wget connect at given time I need to know its pid. wget -bq url runs like this:
wget -b -q -O output-file url-address Continuing in background, pid 10874.
I should somehow record the pid in a file and use it with the kill command, but I don't know how I could do it.
simple if you have only one instance of wget or want to kill all instances: kill -9 `pidof wget`
Thanks Patrick.
I want to run several (at least 2) wgets parallel. If I had only one I could also use 'killall wget'.
I use wget to record live streams that is why I have to start and stop it at given times.
Istvan
Hi Istvan, Here's a solution based upon mplayer with community 'one-click' installed codecs: E.g. place 'streamcap.sh' in ~/bin - - - - - 8< - - - - - #!/bin/bash # Set 'sleep' value, below, to the length of the show plus # whatever leading / trailing times are needed to avoid # inadvertently 'clipping' the show at it's start or end. NOW=$(date +"%Y%m%d") mplayer -vc null -vo null {stream URI} -dumpstream -dumpfile ~/path/$NOW-Program-Name.mp3 & sleep 62m kill $! - - - - - 8< - - - - - Notes: The 'mplayer ... &' command string is a single line. The closing 'kill $1' terminates mplayer. The above example is called by cron at one minute before show time and the 'sleep' value is set to {show duration} + 2 minutes to yield one minute 'leading' and 'trailing' times. These times can be shortened if your system clock is accurate and the stream times are consistently punctual. hth & regards, Carl -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org