yes right, my uncommented hacks look like cop-outs to the naked eye :)

man ps
man bash

;)

try python btw.

james

On Thu, Oct 16, 2008 at 8:41 AM, Andrew Cilia <[EMAIL PROTECTED]> wrote:

>  Thanks but that sounds like a cop-out ala grande. And besides I wanted to
> know what I was doing wrong not just fixing the problem. Hope you get my
> meaning.
>
> Thanks anyway.
>
>
> On Thu, 2008-10-16 at 08:22 +0000, James Attard wrote:
>
> or else modify the if condition to "-gt 2"
>
>  2008/10/16 Raphael Borg Ellul Vincenti <[EMAIL PROTECTED]>
>
>  Oh.... don't I luv bashisms ...
>
> I slightly rewrote the program and will explain why
>
> #!/bin/bash
> # -C just gives you a list of the processes called what are you doing which
> is more efficient than running multiple greps
> # In this case wc -l should always return at least one line since ps -C
> displays a header even when no processes exist
> cntr=$(/bin/ps -C whatareyoudoing | wc -l)
> #make sure cntr is not empty
> if [ "x$cntr" != "x" -a $cntr -gt 1 ];
>
>   then
>   zenity --info --text "Call Logger Is Already Running"
>   exit 1
> fi
> while true
> do
> sleep 15m
> NOW=`date +"%Y|%m|%d|%H|%M|%S"`
> echo $NOW "|" `zenity --text "Attivita' :$NOW" --entry --title "X'Qed
> Tagħmel Man?" --width 1000 --height 5` >> $HOME/CALLOG &
> done
>
>
>   exit 0
>
> Did that help ?
>
>
>
>   On Thu, Oct 16, 2008 at 10:09 AM, Andrew Cilia <[EMAIL PROTECTED]>
> wrote:
>
>
>    Hiyall,
>      here's a curious one. I created a batch job called whatareyoudoing
> which contains the text you see below. It should be a simple mechanism which
> asks the user what they are doing every 15 minutes  and has a safeguard so
> that it does not run more than once. The problem is that the very first time
> I run it, it's saying that it's running twice. This one has stumped me. Has
> anyone found anything similar??
>
> #!/bin/bash
> cntr=`/bin/ps ax | /bin/grep whatareyoudoing | /bin/grep -v grep | wc -l`
> if [ $cntr -gt 1 ];
> then
>   zenity --info --text "Call Logger Is Already Running"
>   exit 1
> fi
> while true
> do
> sleep 15m
> NOW=`date +"%Y|%m|%d|%H|%M|%S"`
> echo $NOW "|" `zenity --text "Attivita' :$NOW" --entry --title "X'Qed
> Tagħmel Man?" --width 1000 --height 5` >> $HOME/CALLOG &
> done
>
>
>
>
> The information contained in this email is confidential and may be
> privileged. It is intended for the addressee only, if you are not the
> intended recipient please notify the sender and delete the email
> immediately. The contents of this email must not be disclosed or copied
> without the senders consent.
> We cannot accept any responsibility for viruses.
> Any views expressed in this message are those of the individual sender,
> except where the sender specifically states them to be the view of Philip
> Toledo Limited
>
>
>
>
>    _______________________________________________
> MLUG-list mailing list
> [email protected]
> http://linux.org.mt/cgi-bin/mailman/listinfo/mlug-list
>
>
>
>
> _______________________________________________
> MLUG-list mailing list
> [email protected]
> http://linux.org.mt/cgi-bin/mailman/listinfo/mlug-list
>
>
>
>
> --
> www.madvip.net
>
>  _______________________________________________
> MLUG-list mailing [EMAIL 
> PROTECTED]://linux.org.mt/cgi-bin/mailman/listinfo/mlug-list
>
>
> The information contained in this email is confidential and may be
> privileged. It is intended for the addressee only, if you are not the
> intended recipient please notify the sender and delete the email
> immediately. The contents of this email must not be disclosed or copied
> without the senders consent.
> We cannot accept any responsibility for viruses.
> Any views expressed in this message are those of the individual sender,
> except where the sender specifically states them to be the view of Philip
> Toledo Limited
>
> _______________________________________________
> MLUG-list mailing list
> [email protected]
> http://linux.org.mt/cgi-bin/mailman/listinfo/mlug-list
>
>


-- 
www.madvip.net
_______________________________________________
MLUG-list mailing list
[email protected]
http://linux.org.mt/cgi-bin/mailman/listinfo/mlug-list

Reply via email to