You are not logged in.

#1 2008-09-16 01:26:30

tonyisnt
Member
Registered: 2008-03-18
Posts: 158

Can I hold back a conky email script?

For the last few weeks I've happily been using the conkyEmail python script found here, and it works quite well and does what I want it to do.  However, I'm wondering if I could stop this script from checking my mail if, for instance, I have Firefox open, since I have the Gmail Manager extension installed which also checks my mail.  Therefore, I find it unnecessary for conky to check for new mail if the extension is going to do it for me.  I want to keep the extension for a few other features, but I want to keep the conky script, too, since I'm actually away from the computer much of the time, and I don't always sit down to browse the web.

I don't know python and I don't really know anything about programming/scripting at all.  But it shouldn't be too hard to get what I want, should it?  The script can check to see if Firefox is running, and if it is it will exit before it checks my mail.  Or at least that's what I think should be done.

In my very limited (self-taught) experience writing bash scripts I've never been able to figure out an elegant way to do this, either. 

For example...

#!/bin/bash
if [ `ps aux | grep 'quodlibet' | awk '{print $12}' > /tmp/.quod && cat /tmp/.quod | grep /usr/bin/quodlibet` = '/usr/bin/quodlibet' ]; then
  quodlibet --play-pause &&
  rm /tmp/.quod &
else
  audacious --play-pause &
fi

Yikes.  What's the best way to test for whether or not a program is running?

Offline

#2 2008-09-16 01:40:36

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: Can I hold back a conky email script?

if [ $(pidof firefox) ]
then
  # do stuff
fi

Of course make sure firefox is the actual binary, I'm not sure if it is.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

#3 2008-09-16 01:47:49

tonyisnt
Member
Registered: 2008-03-18
Posts: 158

Re: Can I hold back a conky email script?

Of course it's that easy...

I tried my way and it worked, too (substituting quodlibet for firefox, of course), but it's ugly and inefficient and stupid.  Thanks.

Offline

#4 2008-09-16 02:02:32

rson451
Member
From: Annapolis, MD USA
Registered: 2007-04-15
Posts: 1,233
Website

Re: Can I hold back a conky email script?

No problem.


archlinux - please read this and this — twice — then ask questions.
--
http://rsontech.net | http://github.com/rson

Offline

Board footer

Powered by FluxBB