Contact me offlist snzioki@bluewave.co.ke

sent from my Android device

On Jun 21, 2012 8:04 PM, <skunkworks-request@lists.my.co.ke> wrote:
Send Skunkworks mailing list submissions to
       skunkworks@lists.my.co.ke

To subscribe or unsubscribe via the World Wide Web, visit
       http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
or, via email, send a message with subject or body 'help' to
       skunkworks-request@lists.my.co.ke

You can reach the person managing the list at
       skunkworks-owner@lists.my.co.ke

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Skunkworks digest..."


Today's Topics:

  1. Power Backup - Inverter + battery (Michuki Mwangi)
  2. Re: Power Backup - Inverter + battery (Vincent Wayodi)
  3. Re: Africa News Challenge Workshop (Phares Kariuki)
  4. Re: A bash scripting question (Laban Mwangi)


----------------------------------------------------------------------

Message: 1
Date: Thu, 21 Jun 2012 12:13:06 +0300
From: Michuki Mwangi <michuki@swiftkenya.com>
To: Skunkworks forum <skunkworks@lists.my.co.ke>
Subject: [Skunkworks] Power Backup - Inverter + battery
Message-ID: <4FE2E5A2.1040207@swiftkenya.com>
Content-Type: text/plain; charset=ISO-8859-1

Hi Folks,

Has anyone installed power backup solution that is based on an Inverter
system with a battery bank. Am looking for a SOHO solution and costs.
Additional information such as the load capacity, space requirements,
battery types/sizez (maintenance or maintenance free), inverter
features, etc would be appreciated.

Thanks,

Mich.





------------------------------

Message: 2
Date: Thu, 21 Jun 2012 17:30:16 +0300
From: Vincent Wayodi <wayodi@gmail.com>
To: michuki@swiftkenya.com,     Skunkworks Mailing List
       <skunkworks@lists.my.co.ke>
Subject: Re: [Skunkworks] Power Backup - Inverter + battery
Message-ID:
       <CAANMRh2DSUVN5BmSa2irC=eKw-Pe8Q8uPu3jBPfwq9m67LyHFA@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

I would highly recommend either speaking to "Chloride Exide"

http://www.cekl.com/index.php?option=com_content&view=article&id=84&Itemid=27


or  Davis and Shirtliff
http://www.dayliff.com/index.php?option=com_content&view=article&id=263&Itemid=265

as they have highly specialized power backup system solutions
(warranty+support included). There are a lot of other vendors that offer
the same,but it all comes down to cost.  I am sure they will point you in
the right direction of what you need.


thanks

Vince
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.my.co.ke/cgi-bin/mailman/private/skunkworks/attachments/20120621/3b91f4eb/attachment-0001.htm>

------------------------------

Message: 3
Date: Thu, 21 Jun 2012 20:33:01 +0300
From: Phares Kariuki <pkariuki@gmail.com>
To: Skunkworks List <skunkworks@lists.my.co.ke>
Subject: Re: [Skunkworks] Africa News Challenge Workshop
Message-ID:
       <CALHqrZxv7a=3Fwam3W00RVMtvT3=pcMUOyZ6Ha+EdaS_Hzw6EQ@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Just a reminder... Tomorrow morning...

On Mon, Jun 18, 2012 at 12:10 PM, Phares Kariuki <pkariuki@gmail.com> wrote:

> Hi,
>
> This is happening this Friday at 9 am, at the iHub...
>
> http://www.ihub.co.ke/pages/event_details.php?id=289
>
>
> --
> Warm Regards,
>
> Phares Kariuki
>
> | T: +254 720 406 093 | E: pkariuki@gmail.com | Twitter: kaboro |
> Skype: kariukiphares | B: http://www.kaboro.com/ |
>



--
Warm Regards,

Phares Kariuki

| T: +254 720 406 093 | E: pkariuki@gmail.com | Twitter: kaboro | Skype:
kariukiphares | B: http://www.kaboro.com/ |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.my.co.ke/cgi-bin/mailman/private/skunkworks/attachments/20120621/78d6c914/attachment-0001.htm>

------------------------------

Message: 4
Date: Thu, 21 Jun 2012 22:04:26 +0200
From: Laban Mwangi <lmwangi@gmail.com>
To: Skunkworks Mailing List <skunkworks@lists.my.co.ke>
Subject: Re: [Skunkworks] A bash scripting question
Message-ID:
       <CAK-xzWo6SqEsTWqFTvvUoZT16BCR_rkXOMOVKBCsDnjCvgWj6Q@mail.gmail.com>
Content-Type: text/plain; charset="utf-8"

Did you want this?
??laban at ubuntu in /tmp @ '2012-06-21 21:41:15'
??? head sms_file
A   +254XXXXX    F  RR
A   +255YYYYYY   G HH
A   +256ZZZZZ    K LL
??laban at ubuntu in /tmp @ '2012-06-21 21:41:24'
??? IFS="
dquote> "
??laban at ubuntu in /tmp @ '2012-06-21 21:41:33'
???  for line in $(< sms_file)
for> do
for>   echo processing $line;
for>   field1=$(echo $line | awk '{print $1}'); phone_no=$(echo $line | awk
'{print $2}'); field3=$(echo $line | awk '{print $3}');
for>   echo "Processed -> $field1::$phone_no::$field3";
for>   echo;
for> done
processing A   +254XXXXX    F  RR
Processed -> A::+254XXXXX::F

processing A   +255YYYYYY   G HH
Processed -> A::+255YYYYYY::G

processing A   +256ZZZZZ    K LL
Processed -> A::+256ZZZZZ::K

The trick here is using IFS (Internal Field Separator) to tell the shell to
split on newlines not whitespace.
However, that is serialized.. Let's slow things a bit by injecting some
ZZZs..

??laban at ubuntu in /tmp @ '2012-06-21 21:51:24'
??? sendsms () { line=$1; echo processing $line; field1=$(echo $line | awk
'{print $1}'); phone_no=$(echo $line | awk '{print $2}'); field3=$(echo
$line | awk '{print $3}'); sleep 5; echo "Processed ->
$field1::$phone_no::$field3"; echo; }
??laban at ubuntu in /tmp @ '2012-06-21 21:51:52'
??? {time (for line in $(< sms_file); do sendsms $line; done) }
processing A   +254XXXXX    F  RR
Processed -> A::+254XXXXX::F

processing A   +255YYYYYY   G HH
Processed -> A::+255YYYYYY::G

processing A   +256ZZZZZ    K LL
Processed -> A::+256ZZZZZ::K

( for line in $(< sms_file); do; sendsms $line; done; )  0,01s user 0,02s
system 0% cpu 15,057 total

15 seconds for 3 messages! Since you are into bulk sms you might want
something a little bit faster. Enter xargs
1. Move sendsms into a standalone script that works on one line per
invocation
2. Parallel invoke the sendsms with xargs -P


??laban at ubuntu in /tmp @ '2012-06-21 22:00:16'
??? cat sendsms.sh

#!/bin/bash -

set -o nounset                              # Treat unset variables as an
error

sendsms () {
 line=$1;
 echo processing $line;
 field1=$(echo $line | awk '{print $1}');
 phone_no=$(echo $line | awk '{print $2}');
 field3=$(echo $line | awk '{print $3}');

 sleep 5;
 echo "Processed -> $field1::$phone_no::$field3";
 echo;
}

sendsms "$@"
??laban at ubuntu in /tmp @ '2012-06-21 22:00:28'
??? {time (cat sms_file | xargs --max-procs=10 --max-args=1 --replace=Z
./sendsms.sh Z) }
processing A +256ZZZZZ K LL
processing A +254XXXXX F RR
processing A +255YYYYYY G HH
Processed -> A::+256ZZZZZ::K

Processed -> A::+255YYYYYY::G
Processed -> A::+254XXXXX::F


( cat sms_file | xargs --max-procs=10 --max-args=1 --replace=Z ./sendsms.sh
Z)  0,00s user 0,02s system 0% cpu 5,027 total

And we have (!web) shell scale :)

On Thu, Jun 21, 2012 at 3:08 PM, Thuo Wilson <lixton@gmail.com> wrote:

> Well, still scratching my head and am heading somewhere;
> This is doing exactly what i need BUT reading one line at a time untill
> the 10th line, if i want more i add manually...
> This might help some1 someday! But if there is a way to perfect it please
> do so.....
>
> #!/bin/bash
>
> smsfile=email_to_sms
> `grep Subject /var/spool/mail/sms >> email_to_sms`
> if [[ -s $smsfile ]] ; then
> cat /dev/null > /var/spool/mail/sms
> sed -i 's/Subject: //g' $smsfile
> echo `sed -n '1p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==1
> {print $1}' $smsfile`
> echo `sed -n '2p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==2
> {print $1}' $smsfile`
> echo `sed -n '3p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==3
> {print $1}' $smsfile`
> echo `sed -n '4p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==4
> {print $1}' $smsfile`
> echo `sed -n '5p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==5
> {print $1}' $smsfile`
> echo `sed -n '6p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==6
> {print $1}' $smsfile`
> echo `sed -n '7p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==7
> {print $1}' $smsfile`
> echo `sed -n '8p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==8
> {print $1}' $smsfile`
> echo `sed -n '9p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==9
> {print $1}' $smsfile`
> echo `sed -n '10p' $smsfile` | /usr/bin/gammu --sendsms TEXT `awk 'NR==10
> {print $1}' $smsfile`
> else
> echo "***********Sorry the SMS FILE "$smsfile" is empty.************"
> fi
> /etc/init.d/gammu-smsd start
> cat email_to_sms >> email_to_sms2
> cat /dev/null > email_to_sms
>
>
>
>
> On 19 June 2012 12:48, Thuo Wilson <lixton@gmail.com> wrote:
>
>>
>>
>> On 18 June 2012 19:51, Odhiambo Washington <odhiambo@gmail.com> wrote:
>>
>>>
>>>
>>> On Mon, Jun 18, 2012 at 5:08 PM, Thuo Wilson <lixton@gmail.com> wrote:
>>>
>>>>
>>>>
>>>> On 18 June 2012 16:34, Odhiambo Washington <odhiambo@gmail.com> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Mon, Jun 18, 2012 at 4:01 PM, Thuo Wilson <lixton@gmail.com> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On 18 June 2012 10:52, gisho <gichuhie@gmail.com> wrote:
>>>>>>
>>>>>>> - as @wash said above, only move the specific file - not everything
>>>>>>> which is denoted by "*" so this should look like mv /tmp/$f /tmp2
>>>>>>>
>>>>>>> - instead of reading mail spool, you can pipe incoming mails to a
>>>>>>> script either by using procmailrc or by using /etc/aliases file if using
>>>>>>> postfix. this could look like this:
>>>>>>>
>>>>>>> smsemail:  "|/usr/libexec/postfix/trap.py"
>>>>>>>
>>>>>>
>>>>>> Thanks Gisho,
>>>>>> Thats is *part* of what i needed. I will use the alias. But note
>>>>>> supposing am doing bulk sms - this may [not affirmative] fail due to
>>>>>> numbers of emails < inflow...
>>>>>>  Second: i decided to change script to read as follows; simpler but
>>>>>> doing better [?]
>>>>>>
>>>>>> Imagine i don't have the script called from alias. How do i read one
>>>>>> line at a time in the file "email_to_sms" and exec the command to send the
>>>>>> sms. That is my main issue
>>>>>>
>>>>>>
>>>>>
>>>>>> Am sure its something simple i havent scratched my head enough!
>>>>>>
>>>>>>  #!/bin/bash
>>>>>> `grep Subject /var/spool/mail/sms > email_to_sms`
>>>>>>  cat /dev/null > /var/spool/mail/sms
>>>>>> killall -9 gammu-smsd                      #since for some reason
>>>>>> gammu-smsd is using use_lock and wont disable
>>>>>>  echo `cat email_to_sms` | /usr/bin/gammu --sendsms TEXT `awk
>>>>>> '{print $2}' email_to_sms`
>>>>>> sleep 15                  #wait for the above to finish
>>>>>>  /etc/init.d/gammu-smsd start   #start to continue checking any
>>>>>> incoming sms
>>>>>> cat email_to_sms >> email_to_sms2  #incase make a backup file
>>>>>>  cat /dev/null > email_to_sms #empty for no2 message in the line :)
>>>>>>
>>>>>>
>>>>> for sure slowly we are getting there...
>>>>>
>>>>
>>>>
>>>>> So the file email_to_sms is a text file containing some data you need
>>>>> to work on, each line at a time:
>>>>>
>>>>> for data in `cat email_to_sms`; do echo $data | /usr/bin/gammu $ARGS
>>>>> .....; done
>>>>>
>>>>
>>>>
>>>> isnt this doing same thing as my script? :)
>>>>
>>>>>
>>>>> That will surely iterate through all the data in the file, one line at
>>>>> a time... You can do loop processing until there is nothing left, or always
>>>>> check if exists a file before you act on it..
>>>>>
>>>>> However at this point, I suggest you work on a file which has been
>>>>> moved to another directory, so move the file first and reference it from
>>>>> where it is. Since the filenames seem to clash at some point (or why do you
>>>>> wven want to move the files?) then my initial suggestion stands - append
>>>>> the current timestamp value to the filename to make it unique.
>>>>>
>>>>> Please try and tell breakdown what this command line does:
>>>>>
>>>>> echo `cat email_to_sms` | /usr/bin/gammu --sendsms TEXT `awk '{print
>>>>> $2}' email_to_sms`
>>>>>
>>>> assuming the file content looks like:
>>>>
>>>> A   +254XXXXX    F
>>>>  A   +255YYYYYY   G
>>>> A   +256ZZZZZ    K
>>>>
>>>> echo `cat email_to_sms` The command just get the file content - first
>>>> part;
>>>>  /usr/bin/gammu --sendsms TEXT `awk '{print $2}' email_to_sms` - send
>>>> an sms to the number on the second column (2) in the file email_to_sms
>>>>
>>>>
>>>>
>>>>>
>>>>> Then again, if you need a program to rexec, there is no need to give
>>>>> it a SIGKILL (-9). Just do a SIGHUP (-1)
>>>>>  So you can rexec gammu after it completes processing the first file
>>>>> while making it loop to look for the existence of another file in the
>>>>> parent directory ... and the loop continues...
>>>>>
>>>> Not bad thought!
>>>>
>>>
>>> [wash@jaribu ~/THUO]$ pwd
>>> /home/wash/THUO
>>>
>>> [wash@jaribu ~/THUO]$ ls -1
>>> email_to_sms
>>> email_to_sms1
>>> email_to_sms2
>>> [wash@jaribu ~/THUO]$ file=`ls -1`
>>> [wash@jaribu ~/THUO]$ telno=`cat $file | awk '{print $2}'`
>>> [wash@jaribu ~/THUO]$ for t in $telno; do echo -e "$t\n"; done
>>> +254XXXXX
>>>
>>> +255YYYYYY
>>>
>>> +256ZZZZZ
>>>
>>> +333XXXXX
>>>
>>> +444YYYYYY
>>>
>>> +555ZZZZZ
>>>
>>> +6664XXXXX
>>>
>>> +7774YYYYYY
>>>
>>> +8884ZZZZZ
>>>
>>>
>>>
>>> I hope this gives you some clue. It's a way to deal with each file at a
>>> time..
>>>
>>>
>> I want other text too
>>
>> A   +254XXXXX    F  RR
>>  A   +255YYYYYY   G HH
>> A   +256ZZZZZ    K LL
>>
>>  My dilemma is this in simple terms.
>>
>> Read line 1 then execute a command
>>  *if there is another line? "if"*
>> Read line 2 then execute a command
>> Read line 3 then execute a command
>>  Note:i can also read all the columns and read all rows at a go with
>> awk. But narrowing down to row/line at a time - sijui hiyo!
>>
>> Reading the file i know how to- is not a problem - my script is doing, *but
>> reading a line at a time then EXEC,  line2 then EXEC,  line3 then EXEC -
>> that is my issue :)*
>>  *
>> *
>>
>>
>>
>>>
>>> --
>>> Best regards,
>>> Odhiambo WASHINGTON,
>>> Nairobi,KE
>>> +254733744121/+254722743223
>>> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
>>> I can't hear you -- I'm using the scrambler.
>>>
>>>
>>> _______________________________________________
>>>  Skunkworks mailing list
>>> Skunkworks@lists.my.co.ke
>>> ------------
>>> List info, subscribe/unsubscribe
>>> http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
>>>  ------------
>>>
>>> Skunkworks Rules
>>> http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
>>>  ------------
>>> Other services @ http://my.co.ke
>>>
>>
>>
>
> _______________________________________________
> Skunkworks mailing list
> Skunkworks@lists.my.co.ke
> ------------
> List info, subscribe/unsubscribe
> http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
> ------------
>
> Skunkworks Rules
> http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
> ------------
> Other services @ http://my.co.ke
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://orion.my.co.ke/cgi-bin/mailman/private/skunkworks/attachments/20120621/745a48e3/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/gif
Size: 96 bytes
Desc: not available
URL: <http://orion.my.co.ke/cgi-bin/mailman/private/skunkworks/attachments/20120621/745a48e3/attachment.gif>

------------------------------

_______________________________________________
Skunkworks mailing list
Skunkworks@lists.my.co.ke
http://lists.my.co.ke/cgi-bin/mailman/listinfo/skunkworks
------------
Skunkworks Server donations spreadsheet
http://spreadsheets.google.com/ccc?key=0AopdHkqSqKL-dHlQVTMxU1VBdU1BSWJxdy1fbjAwOUE&hl=en
------------
Skunkworks Rules
http://my.co.ke/phpbb/viewtopic.php?f=24&t=94
------------
Other services @ http://my.co.ke

End of Skunkworks Digest, Vol 28, Issue 250
*******************************************