LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-23-2009, 03:59 AM   #1
eoinjones
LQ Newbie
 
Registered: Aug 2008
Distribution: Fedora
Posts: 8

Rep: Reputation: 0
Log of Running Software in Fedora 10?


Hi everyone. I am totally new to Shell Scripting but I want to write a little script to set Operas integrated email program as the default mail program in Fedora 10. As it is an integrated component of the browser it currently doesn't appear in the list of mail programs in the Fedora GUI. I propose to set the default mail program as a shell script which will call up Opera Mail. I want the script to check to see if Opera is open, and if so, open Opera Mail using the remote command. If Opera is not open it should firstly open Opera and then open Opera Mail using the remote command.
Is there any way to check if a program is running from the terminal? Is there a log file or something that just lists running software perhaps? Sorry for such a noob question but you can't learn new things without starting somewhere. It will be very useful to be able to properly link Opera Mail with the Mail Notification panel applet.
Thanks in adbance for any help,
Eoin.
 
Old 01-23-2009, 04:22 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
just use pidof or ps
 
Old 01-24-2009, 03:51 AM   #3
eoinjones
LQ Newbie
 
Registered: Aug 2008
Distribution: Fedora
Posts: 8

Original Poster
Rep: Reputation: 0
Yeah, thanks for the reply Chris. For anybody else who wants to be able to click on the mail notification panel app and open Opera Mail when there is new mail, here is what to do. Open a text editor like gedit and copy and paste the following:

#!/bin/sh
mail-notification -r
if ps ax | grep -v grep | grep /usr/lib/opera/*/opera > /dev/null
then opera -remote "openM2()"
else opera -mail
fi

Make sure /usr/lib/opera/*/opera corresponds with the actual path on your system. You can probably replace this whole path with simply "opera" and it will work also. Afterwards, save the file somewhere with the ".sh" ending to remind you that it is a script. In a terminal user logged in as root make the script executable with the following command:

chmod filename.sh a+x

Replacing filename with the actual filename obviously. Now set this script as your default mail program in System-Preferences-Personal-Preferred Applications menu under custom command. Ensure to include the path to your script ( eg /home/your_username/shell_scripts/filename.sh ) Set the mail-notification "click-action" to open the default mail program.

Hope this might be useful for someone else too.

Last edited by eoinjones; 01-24-2009 at 03:52 AM. Reason: missing comma
 
Old 01-24-2009, 04:42 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
much quicker...

pidof opera && opera -remote "openM2()" || opera -mail
 
Old 01-26-2009, 12:27 PM   #5
eoinjones
LQ Newbie
 
Registered: Aug 2008
Distribution: Fedora
Posts: 8

Original Poster
Rep: Reputation: 0
Suspected there might have been a more direct way of doing it. As I said, new to shell scipting.
 
  


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
Fedora 6 problem running RH7 software marty2007 Red Hat 9 11-24-2007 02:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:00 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