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

Posted on

Problem :

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?

Solution :

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

It’s ghetto but it should work.

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

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:


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

Leave a Reply

Your email address will not be published. Required fields are marked *