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


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

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-27 18:10 +0000
Organization A noiseless patient Spider
Message-ID <m2m1rf$6bh$1@dont-email.me> (permalink)
References <XnsA3D2BB8ABDCA70xDEADBEEF@213.239.209.88>

Cross-posted to 2 groups.

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

Show all headers | View raw


In article <XnsA3D2BB8ABDCA70xDEADBEEF@213.239.209.88>, Ian Malcolm <See.My.Sig.for.email@totally.invalid> wrote: 

> not.socialnetwork@gmail.com wrote in news:m2jbi3$geq$1@dont-email.me:
> 
> > I need to capture the time-after-a-sound-file-starts-playing
> > until the power is cut, with a resolution of 30 secs., over a
> > period of 30 minutes.
> > 
> > While `ogg123  SoundFie.ogg` is playing, could the play-time
> > be updated every 30 secs?  How?
> > 
> > == TIA.
> > 
> > PS. power-cuts without `umount` are no problem for rPi's
> > SD nor USBstik.
> 
> However a power failure in the middle of a write commonly corrupts SD 
> cards and in some cases has been known to make them unusable.
> 
Apparently the rPi <lands safetly> as <the voltage is dropping>.
It's never failed during 5 cuts/day for 200 days.

> Most RTC chips have a small amount of battery backed scratchpad RAM.  
> Store timestamps for the start time + the current time in the scratchpad 
> and update at least every 30 seconds.   Due to the risk of a power 
> failure while updating the current time, you should use a checksum and 
> use two different locations, alternating between them.
> 
> The details of how to implement this in a Python script will depend on 
> the chip on your RTC module . . . .
> -- 
> Ian Malcolm. 
No Python. Just a bash script.
=======================================
From: William Unruh <unruh@invalid.ca>

]Power is cut? What does that mean? 
In the next paragraph, you've decided you know what it means.

> While `ogg123  SoundFie.ogg` is playing, could the play-time
> be updated every 30 secs?  How?
]How are you playing it, what is the player software?

`ogg123  SoundFie.ogg` means <SoundFie.ogg>,
is being played by "ogg123".

]Usually you can get a pretty good idea of the time of a power cut by
]looking at /var/log/messages and seeing when the last message
] was written before the cut.

 tail /var/log/messages  <--after start playing
 Oct 27 19:14:28 dog kernel: EXT4-fs: mounted filesystem sdc2 with ordered data mode
tail: cannot open `==' for reading: No such file or directory

 date  <-- during  playing
Mon Oct 27 19:15:35 SAST 2014

 tail /var/log/messages  <-- during  playing
Oct 27 19:14:28 dog kernel: EXT4-fs: mounted filesystem sdc2 with ordered data mode
tail: cannot open `==' for reading: No such file or directory

]POwer cuts are no problem for reading any medium. It is writing
]that is the problem.

Yes, but as the other respondent implies: the system could be writng
as part of it's <house-keeping>.
==========================================
Andrew Gabriel wrote:

]Pi's don't require much power, so you could keep the Pi running
]for a short time using stored power, and feed the real power loss
]signal into one of it's GPIO inputs, to be actioned by relevant
]software (such as logging the event and/or telling another system
]across the network), and finally trigger a clean shutdown before
]the stored power source runs out.

No, no extra hardware than the existing control, by switching-off
is allowed. Software could do:

N=ReadFileOfLatestTimePlayedSinceTrackStart
IF FileMarked=CutDuringPlay  // instead of during safePausePeriod
   THEN <Calculate restart Play N secs before Cut>
         ogg123 <M(N) secs FromBeginning>
   END      
   
]The risk is the flash memory microcode being interrupted in the
]middle of a critical operation, leaving some structure like the
]logical to physical block map corrupt, i.e. shuffling some of
]the blocks in the flash memory, although it may decide it's not
]going to play at all when next powered up.
]Enterprise class SSDs will protect themselves from this type of
]event, but cheap SD cards and USB sticks don't.

Sure. But it's survived 1'000 power cuts.
It must be designed to manage.

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.

== 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