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


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

Re: HOW2 capture time of power-failure?

From not.socialnetwork@gmail.com
Newsgroups comp.os.linux.misc, comp.sys.raspberry-pi
Subject Re: HOW2 capture time of power-failure?
Followup-To comp.os.linux.misc, comp.sys.raspberry-pi
Date 2014-10-29 00:12 +0000
Organization A noiseless patient Spider
Message-ID <m2pbe5$br6$1@dont-email.me> (permalink)
References <m2ndr4$5uu$1@dont-email.me>

Cross-posted to 2 groups.

Followups directed to: comp.os.linux.misc, comp.sys.raspberry-pi

Show all headers | View raw


In article <m2ndr4$5uu$1@dont-email.me>, William Unruh <unruh@invalid.ca> wrote: 

> 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

# check for ogg123 & mask-out "grep"

>> do
>> date >/tmp/timestamp <- date >> ./Clok
>> sleep 10
>> done
>> sleep 10
>> done
>>
>> and run it in the background when you start the ogg program.

? HOW2 call it <in the background> FROM the StikPlay.sh which
autoruns at boot/power-on ?

>
> 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).

I'll write LOCAL ie. toTheStik = ./
There's no need to contaminate the 'system'.

> 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 original design/tests failed because of such MULTIproccessor background
trickery, and needed "sync".
>
> The very long "while ps auxww |grep ogg123 |grep -v grep >/dev/null" 
> could be replaced by "while pidof ogg123 >/dev/null".

]Fair enough. 

There's no terminal to not-write-to, and reduced concepts are good.
Ie. <while it's still playing>, UpdateTimeStampEvery10Secs
>
> 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.

I want all <subroutines> in 1 script, on the stik. So:
"So that the timer will terminate when the player finishes";
   would be controlled by <while pidof ogg123>.
   
"And so that the timer does not start & finish before the player starts".
 Yes, that's needed too, but it's not clear to me how it's achieved.

Can't we make a single minimalist test-script, which runs on the PC 
[instead of 'silently/hidden' on the rPi] , with the following structure:--

# Main block is just a sequence of `oplay  FILENAME`
oplay  FILENAME1
oplay  FILENAME2
oplay  FILENAME3

# single level-1 subroutine [omitting my other existing controls]
# can we set the "backgrounding" in this subroutine? & HOW?
oplay()
{   <proposed code>
}

== TIA.

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