LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Log of Running Software in Fedora 10? (https://www.linuxquestions.org/questions/linux-newbie-8/log-of-running-software-in-fedora-10-a-699318/)

eoinjones 01-23-2009 03:59 AM

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.

acid_kewpie 01-23-2009 04:22 AM

just use pidof or ps

eoinjones 01-24-2009 03:51 AM

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.

acid_kewpie 01-24-2009 04:42 AM

much quicker...

pidof opera && opera -remote "openM2()" || opera -mail

eoinjones 01-26-2009 12:27 PM

Suspected there might have been a more direct way of doing it. As I said, new to shell scipting.


All times are GMT -5. The time now is 04:37 AM.