Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.raspberry-pi > #25785
| From | Simple Simon <please.dontspa@me.com> |
|---|---|
| Newsgroups | comp.sys.raspberry-pi |
| Subject | Re: Battery Powered Project |
| Date | 2021-01-12 12:50 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <rtk5ur$qi$1@gioia.aioe.org> (permalink) |
| References | <rtk3qv$1112$1@gioia.aioe.org> <nuh0dh-2vq01.ln1@esprimo.zbmc.eu> |
Chris Green wrote: > Simple Simon <please.dontspa@me.com> wrote: >> I am working on a battery powered car and want the Pi to shut down >> automatically if the battery starts to go flat to try to prevent SD card >> corruption. I am a beginner to bash scripts! I will run this via crontab... >> >> #!/bin/bash >> powerstatus=$(vcgencmd get_throttled) >> if [ $powerstatus="throttled=0x1" ] >> then >> echo Under Voltage Detected - Shutting Down >> sudo halt >> else >> echo Voltage Normal >> fi >> >> Obviously it is not working!! Could someone correct and explain for me >> please. > > You need spaces in the test:- > > if [ $powerstatus = "throttled=0x1" ] > > Without the spaces you are just testing if '$powerstatus="throttled=0x1"' > is not an empty string, and it never will be an empty string. > > Brilliant - many thanks - works a treat - I was almost there!!
Back to comp.sys.raspberry-pi | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Battery Powered Project Simple Simon <please.dontspa@me.com> - 2021-01-12 12:14 +0000
Re: Battery Powered Project Chris Green <cl@isbd.net> - 2021-01-12 12:40 +0000
Re: Battery Powered Project Simple Simon <please.dontspa@me.com> - 2021-01-12 12:50 +0000
Re: Battery Powered Project "A. Dumas" <alexandre@dumas.fr.invalid> - 2021-01-12 15:15 +0100
Re: Battery Powered Project Theo <theom+news@chiark.greenend.org.uk> - 2021-01-12 21:43 +0000
Re: Battery Powered Project Jan Panteltje <pNaOnStPeAlMtje@yahoo.com> - 2021-01-13 09:40 +0000
Re: Battery Powered Project Jim H <invalid@invalid.invalid> - 2021-01-13 18:02 +0000
Re: Battery Powered Project Joe <joe@jretrading.com> - 2021-01-13 22:04 +0000
Re: Battery Powered Project Theo <theom+news@chiark.greenend.org.uk> - 2021-01-13 23:37 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-14 00:43 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 03:59 +0000
Re: Battery Powered Project Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-14 10:18 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 11:04 +0000
Re: Battery Powered Project Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-14 11:46 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 12:21 +0000
Re: Battery Powered Project Ahem A Rivet's Shot <steveo@eircom.net> - 2021-01-14 12:38 +0000
Re: Battery Powered Project David Higton <dave@davehigton.me.uk> - 2021-01-14 14:17 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 14:28 +0000
Re: Battery Powered Project David Higton <dave@davehigton.me.uk> - 2021-01-16 20:09 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-17 07:19 +0000
Re: Battery Powered Project David Higton <dave@davehigton.me.uk> - 2021-01-17 15:57 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-18 07:05 +0000
Re: Battery Powered Project David Higton <dave@davehigton.me.uk> - 2021-01-18 14:14 +0000
Re: Battery Powered Project John Aldridge <jpsa@cantab.net> - 2021-01-17 17:52 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-14 12:56 +0000
Re: Battery Powered Project Theo <theom+news@chiark.greenend.org.uk> - 2021-01-14 13:46 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 14:26 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 03:46 +0000
Re: Battery Powered Project Folderol <general@musically.me.uk> - 2021-01-14 09:23 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-14 11:04 +0000
Re: Battery Powered Project Folderol <general@musically.me.uk> - 2021-01-14 17:48 +0000
Re: Battery Powered Project Jim H <invalid@invalid.invalid> - 2021-01-18 17:07 +0000
Re: Battery Powered Project Joe <joe@jretrading.com> - 2021-01-18 20:33 +0000
Re: Battery Powered Project Jim H <invalid@invalid.invalid> - 2021-01-21 20:36 +0000
Battery Powered Project nospam.Vincent.Coen@f1.n250.z2.binkp.net (Vincent Coen) - 2021-01-12 14:35 +1300
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-12 16:40 +0000
Re: Battery Powered Project The Natural Philosopher <tnp@invalid.invalid> - 2021-01-13 13:56 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-13 15:12 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-16 12:24 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-16 17:53 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-16 20:39 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-16 22:33 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-16 23:30 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-16 23:52 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-17 10:39 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-17 14:32 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-18 13:20 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-18 13:41 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-18 14:02 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-18 15:15 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-19 13:46 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-19 15:24 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-19 15:34 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-19 16:21 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-19 17:18 +0000
Re: Battery Powered Project Richard Kettlewell <invalid@invalid.invalid> - 2021-01-19 19:31 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-20 10:12 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-19 22:15 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-20 10:03 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 10:49 +0000
Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-20 11:29 +0000
Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-20 12:18 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 13:02 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-20 15:49 +0000
Re: Battery Powered Project Richard Kettlewell <invalid@invalid.invalid> - 2021-01-20 16:54 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 17:19 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-21 10:24 +0000
Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-20 12:18 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 13:18 +0000
Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-20 14:14 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-20 14:51 +0000
Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-20 14:45 +0000
Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-20 14:44 +0000
Re: Battery Powered Project Richard Kettlewell <invalid@invalid.invalid> - 2021-01-20 15:07 +0000
Re: Battery Powered Project "A. Dumas" <alexandre@dumas.fr.invalid> - 2021-01-20 16:38 +0100
Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-20 15:45 +0000
Re: Battery Powered Project druck <news@druck.org.uk> - 2021-01-21 10:07 +0000
Re: Battery Powered Project "A. Dumas" <alexandre@dumas.fr.invalid> - 2021-01-21 12:30 +0100
Re: Battery Powered Project druck <news@druck.org.uk> - 2021-01-21 13:09 +0000
Re: Battery Powered Project Anssi Saari <as@sci.fi> - 2021-01-22 10:08 +0200
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-22 10:29 +0000
Re: Battery Powered Project Chris Green <cl@isbd.net> - 2021-01-22 10:25 +0000
Re: Battery Powered Project Kees Nuyt <k.nuyt@nospam.demon.nl> - 2021-01-19 17:03 +0100
Re: Battery Powered Project A. Dumas <alexandre@dumas.fr.invalid> - 2021-01-17 01:09 +0000
Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-17 11:48 +0000
Re: Battery Powered Project Pancho <Pancho.Dontmaileme@outlook.com> - 2021-01-17 12:11 +0000
Re: Battery Powered Project Martin Gregorie <martin@mydomain.invalid> - 2021-01-17 14:43 +0000
Re: Battery Powered Project Chris Elvidge <chris@mshome.net> - 2021-01-17 11:52 +0000
Re: Battery Powered Project Andy Burns <usenet@andyburns.uk> - 2021-01-17 13:53 +0000
csiph-web