Linux: How to start Skype (or other program) only when I'm online?

0

I've added Skype to my "Startup applications" list, so that it starts automatically after I log in. (This is on Ubuntu 9.04 Jaunty, with the Gnome desktop)

However, I frequently use my laptop offline, and then Skype is less than useless: it just serves to annoy me with a startup noise and permanently animated toolbar icon.

Is there a way to tell Skype to start only when I'm online? Can I use Upstart to do something like that?

amarillion

Posted 2009-09-28T14:54:07.733

Reputation: 273

Consider adding ubuntu to the tag list. – Nick Stinemates – 2009-09-28T21:01:49.533

Answers

1

Add a script to your bin directory, and start that script instead of starting skype.

The script will look kind of like this:

#!/bin/bash -f
if [[ `ifconfig eth0|grep 'inet addr'` ]] ; then
    skype
fi

It's ghetto but it should work.

pbr

Posted 2009-09-28T14:54:07.733

Reputation: 1 285

perhaps adding this script to autorun should be helpfull – bbaja42 – 2009-11-06T10:53:29.103

You can simplify this to if ifconfig eth0|grep -q 'inet addr' Still, perhaps not the best way to check for connectivity. It also hard-codes the interface name. – Joseph R. – 2013-09-01T20:22:46.837

0

This might be helpful for you . Actually i have asked this question for empathy chat client . I guess u can do for skype also

joe

Posted 2009-09-28T14:54:07.733

Reputation: 11 615

0

Try this script. It uses a ping test to determine whether you're online, launches Skype if you are and warns you if you're not:

#!/bin/bash

if ping -c 1 -W 5 google.com &>/dev/null;then
    exec skype
else
    echo "No Internet connectivity. Bailing..."
    exit 1
fi

Joseph R.

Posted 2009-09-28T14:54:07.733

Reputation: 474