LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-22-2008, 01:36 PM   #1
ameyjah
LQ Newbie
 
Registered: Apr 2008
Posts: 13

Rep: Reputation: 0
how can I create dual application launcher


May be the title is bit confusing...

I want to create one application launcher (one small program) which will do the following things.

1) On first click(execution) it should execute following command
sudo pon dsl-provider
2) If I once again execute the same file it should execute following command
sudo poff

Can you tell me how to create one such application
 
Old 04-22-2008, 01:57 PM   #2
rg.viza
Member
 
Registered: Aug 2006
Posts: 74

Rep: Reputation: 15
make a script that looks for the existence of the pid (or greps ps output) and test the output of the grep.

If the first isn't running start sudo pon dsl-provider >>/dev/null 2>&1 & and exit.
If the first is running but not the second, start sudo poff >>/dev/null 2>&1 & and exit.
If both are running just exit.

It would be useful if you had return messages as well so the user who uses it knows what it did or didn't do.

The gory details of how to code this are a lesson in shell/perl/python/qt (or whatever you choose to use) coding 8)
 
Old 04-22-2008, 02:20 PM   #3
biophysics
Member
 
Registered: Jan 2002
Location: Germany
Distribution: Kubuntu
Posts: 444

Rep: Reputation: 30
Code:
#!/bin/bash

if [ -e /tmp/dsl_running ]; then
      sudo poff >>/dev/null 2>&1 &
      rm -f /tmp/dsl_running
else
       sudo pon dsl-provider >>/dev/null 2>&1 &
       touch /tmp/dsl_running
fi
 
Old 04-22-2008, 08:47 PM   #4
ameyjah
LQ Newbie
 
Registered: Apr 2008
Posts: 13

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by biophysics View Post
Code:
#!/bin/bash

if [ -e /tmp/dsl_running ]; then
      sudo poff >>/dev/null 2>&1 &
      rm -f /tmp/dsl_running
else
       sudo pon dsl-provider >>/dev/null 2>&1 &
       touch /tmp/dsl_running
fi
hey can someone compile me the above code or give direction to use above code
 
Old 04-23-2008, 05:12 AM   #5
biophysics
Member
 
Registered: Jan 2002
Location: Germany
Distribution: Kubuntu
Posts: 444

Rep: Reputation: 30
1. Create a directory called bin in your home folder (normally there might be one)
$ mkdir ~/bin

2. Create a file inside this with
gedit or kwrite or any editor

$ gedit dsl_controller

paste the stuff from above.

3. Type:

$ chmod +x ~/bin/dsl_controller

4. Now, right click on desktop

>>>>>>>>>Select: Create new link to application /launcher

The above may be different in gnome (I have only kde) http://ubuntuforums.org/showthread.php?t=361110
http://www.linuxquestions.org/questi...script-283613/
5. It will open a new box

6. Select there the program you created > "dsl_controller"

7. Press OK

Last edited by biophysics; 04-23-2008 at 05:13 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Application launcher box General Linux - Desktop 0 03-23-2007 03:07 AM
Creating root Application Launcher in GNOME rwillard Linux - Newbie 3 04-06-2005 09:59 AM
How to create a menu group and application launcher? kiranprashant Programming 5 02-26-2005 12:15 AM
How do I create application launcher using bash script msgclb Programming 2 01-30-2005 06:28 AM
Application Launcher jamoraqui Linux - Newbie 9 08-23-2004 06:23 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration