Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.misc > #12535

Re: HOW2 capture time of power-failure?

From William Unruh <unruh@invalid.ca>
Newsgroups comp.os.linux.misc, comp.sys.raspberry-pi
Subject Re: HOW2 capture time of power-failure?
Date 2014-10-28 06:41 +0000
Organization A noiseless patient Spider
Message-ID <m2ndr4$5uu$1@dont-email.me> (permalink)
References <XnsA3D2BB8ABDCA70xDEADBEEF@213.239.209.88> <m2m1rf$6bh$1@dont-email.me> <m2n7m1$ndo$1@dont-email.me> <oJG3w.679289$KL.271645@fx19.am4>

Cross-posted to 2 groups.

Show all headers | View raw


On 2014-10-28, Dom <domafp@blueyonder.co.uk> wrote:
> On 28/10/14 04:56, William Unruh wrote:
>>> Joe Beanfish wrote:-
>>> ]You could start a background process at the same time as the player to
>>> ]save a timestamp every 5-10 seconds.
>>>
>>> Exactly. I'm hoping someone will give me the code.
>>
>> Make a file with the following content
>>
>> #!/bin/bash
>> for ((i=0;i<10;i++))
>> do
>> while ps auxww |grep ogg123 |grep -v grep >/dev/null
>> do
>> date >/tmp/timestamp
>> sleep 10
>> done
>> sleep 10
>> done
>>
>> and run it in the background when you start the ogg program.
>
> Not a good idea to write to /tmp as that will get cleared when the Pi is 
> next powered up (unless you change the default actions for /tmp).

True. Put it somewhere that is not cleared. (I do not have /tmp cleared
on reboot, but I agree that many do).

>
> Change "date >/tmp/timestamp" to "date >~/timestamp" to write to the 
> home directory. Also add a "sync" line in after it to force flushing of 
> the write buffers.
>
> The very long "while ps auxww |grep ogg123 |grep -v grep >/dev/null" 
> could be replaced by "while pidof ogg123 >/dev/null".

Fair enough. 

>
> I'm not sure why you've got two loops there, the for () loop, and the 
> while loop?

So that the script  will terminate when ogg123 actually finishes its
playing of the file. And so that it does not do it immedately since this
program might start before the ogg123 program gets going and terminate
before the ogg123 even gets started.



>

Back to comp.os.linux.misc | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

HOW2 capture time of power-failure? not.socialnetwork@gmail.com - 2014-10-26 17:38 +0000
  Re: HOW2 capture time of power-failure? Ian Malcolm <See.My.Sig.for.email@totally.invalid> - 2014-10-26 18:26 +0000
    Re: HOW2 capture time of power-failure? not.socialnetwork@gmail.com - 2014-10-27 18:10 +0000
      Re: HOW2 capture time of power-failure? Gordon Henderson <gordon+usenet@drogon.net> - 2014-10-27 18:29 +0000
        Re: HOW2 capture time of power-failure? not.socialnetwork@gmail.com - 2014-10-28 21:26 +0000
      Re: HOW2 capture time of power-failure? William Unruh <unruh@invalid.ca> - 2014-10-28 04:56 +0000
        Re: HOW2 capture time of power-failure? Dom <domafp@blueyonder.co.uk> - 2014-10-28 06:29 +0000
          Re: HOW2 capture time of power-failure? William Unruh <unruh@invalid.ca> - 2014-10-28 06:41 +0000
            Re: HOW2 capture time of power-failure? not.socialnetwork@gmail.com - 2014-10-29 00:12 +0000
  Re: HOW2 capture time of power-failure? William Unruh <unruh@invalid.ca> - 2014-10-26 19:23 +0000
    Re: HOW2 capture time of power-failure? spam-no-spam@Freeola.net.invalid (Windmill) - 2014-11-04 13:19 +0000
      Re: HOW2 capture time of power-failure? William Unruh <unruh@invalid.ca> - 2014-11-05 21:56 +0000
        Re: HOW2 capture time of power-failure? Joe Beanfish <joebeanfish@nospam.duh> - 2014-11-06 14:12 +0000
        Re: HOW2 capture time of power-failure? nba@users.sourceforge.net (Niels Baggesen) - 2014-11-06 16:15 +0100
          Re: HOW2 capture time of power-failure? William Unruh <unruh@invalid.ca> - 2014-11-06 16:00 +0000
        Re: HOW2 capture time of power-failure? spam-no-spam@Freeola.net.invalid (Windmill) - 2014-11-06 20:37 +0000
      Re: HOW2 capture time of power-failure? Joe Beanfish <joebeanfish@nospam.duh> - 2014-11-06 14:13 +0000
  Re: HOW2 capture time of power-failure? andrew@cucumber.demon.co.uk (Andrew Gabriel) - 2014-10-26 20:28 +0000
  Re: HOW2 capture time of power-failure? Joe Beanfish <joebeanfish@nospam.duh> - 2014-10-27 13:17 +0000
  Re: HOW2 capture time of power-failure? Jean-David Beyer <jeandavid8@verizon.net> - 2014-10-28 13:43 -0400
    Re: HOW2 capture time of power-failure? Ant <ant@zimage.comANT> - 2014-10-29 08:18 -0700
  Re: HOW2 capture time of power-failure? Joe Beanfish <joebeanfish@nospam.duh> - 2014-10-29 13:28 +0000
    Re: HOW2 capture time of power-failure? not.socialnetwork@gmail.com - 2014-10-30 08:32 +0000
      background processes (was HOW2 capture time of power-failure?) Joe Beanfish <joebeanfish@nospam.duh> - 2014-10-30 13:16 +0000
        Re: background processes (was HOW2 capture time of power-failure?) not.socialnetwork@gmail.com - 2014-11-03 03:25 +0000
          Re: background processes (was HOW2 capture time of power-failure?) "David W. Hodgins" <dwhodgins@nomail.afraid.org> - 2014-11-02 23:34 -0500
          Re: background processes (was HOW2 capture time of power-failure?) William Unruh <unruh@invalid.ca> - 2014-11-03 08:25 +0000
          Re: background processes (was HOW2 capture time of power-failure?) Martin Gregorie <martin@address-in-sig.invalid> - 2014-11-03 12:56 +0000
            Re: background processes (was HOW2 capture time of power-failure?) not.socialnetwork@gmail.com - 2014-11-06 19:19 +0000
              Re: background processes (was HOW2 capture time of power-failure?) Martin Gregorie <martin@address-in-sig.invalid> - 2014-11-07 02:36 +0000
              Re: background processes (was HOW2 capture time of power-failure?) Joe Beanfish <joebeanfish@nospam.duh> - 2014-11-07 14:28 +0000
                Re: background processes (was HOW2 capture time of power-failure?) not.socialnetwork@gmail.com - 2014-11-08 03:32 +0000

csiph-web