LinuxQuestions.org
Visit Jeremy's Blog.
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 11-29-2006, 03:13 PM   #1
pbhj
Member
 
Registered: Dec 2002
Location: UK
Distribution: Slackware 12; Ubuntu 7.10
Posts: 358

Rep: Reputation: 31
kontact startup script - check if started


Hi,

I use bash, could someone help with a script to check if kontact is started and if not start it. With KDE I have kontact in Autostart folder, however if the session-restart starts kontact then I get two copies of the program running which always causes problems. I'd prefer kontact to start with the kmail view.

So far I have :

#!/bin/bash
#
# script to start kontact only if it's not running
if ! [ "ps x | grep -i -e ".*kontact$"" ] ; then
echo "kontact_start: Kontact started now."
fi
# EOF

Thanks
 
Old 11-29-2006, 03:51 PM   #2
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
You could ask dcop:
Code:
if dcop kontact > /dev/null 2>&1; then
    echo "kontact is running"
else
    echo "kontact is not running"
fi
Note that not all programs use dcop. Most KDE apps do, but not much else.
 
Old 12-04-2006, 03:41 PM   #3
pbhj
Member
 
Registered: Dec 2002
Location: UK
Distribution: Slackware 12; Ubuntu 7.10
Posts: 358

Original Poster
Rep: Reputation: 31
Having been using this script for about 4 days I can safely say it kinda works.

That is it's better now. But I still get some crashes. I think perhaps the mechanism (whatever that may be) for restarting KDE sessions takes some time to reset the desktop to its previous state. Sometimes, I suspect, Kontact hasn't started by hte time this script (in Autostart) runs, and sometime it has and kontact crashes through a kmail self-conflict.

So thanks. But it's still not completely fixed it.

I guess I could try adding some wait() in there?

Last edited by pbhj; 12-04-2006 at 03:43 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
X screwey on startup, fine after killed & started again 95se Linux - Laptop and Netbook 0 11-18-2006 12:27 PM
I have started working on a tutorial script kedens Linux - General 6 10-15-2006 04:48 PM
Kontact gives error on startup unholy Mandriva 0 12-18-2004 01:00 PM
KDE edit programs automatically started on startup qwijibow Linux - Newbie 2 08-20-2003 08:23 PM
How Do I Have a script started at boot time? Chijtska Linux - General 12 03-18-2002 05:41 PM


All times are GMT -5. The time now is 12:14 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration