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. |
just use pidof or ps
|
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. |
much quicker...
pidof opera && opera -remote "openM2()" || opera -mail |
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. |