Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[solved] Howto start a runlevel script after kde is running?
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
tomekki
n00b
n00b


Joined: 29 May 2007
Posts: 40

PostPosted: Fri Oct 19, 2007 5:49 pm    Post subject: [solved] Howto start a runlevel script after kde is running? Reply with quote

Hi,
I would like to start couple of my runlevel scripts (with graphical output) after kde is started.

How do do that?

I tried to add in my runlevel scripts 'after xdm' in the depends section but
this did not work.

Thanks in advance ...


Last edited by tomekki on Sat Oct 20, 2007 11:30 am; edited 1 time in total
Back to top
View user's profile Send private message
pussi
l33t
l33t


Joined: 08 May 2004
Posts: 727
Location: Finland

PostPosted: Fri Oct 19, 2007 6:37 pm    Post subject: Reply with quote

I'm not sure if I understood correctly but you can simply run something like /etc/init.d/foo start
Back to top
View user's profile Send private message
pteppic
l33t
l33t


Joined: 28 Nov 2005
Posts: 781

PostPosted: Fri Oct 19, 2007 7:38 pm    Post subject: Reply with quote

If you do mean KDE, as in after a user is logged in and there is a desktop, then create a script in ~/.kde/Autostart. It will get run when KDE starts.
Add the /etc/init.d commands to a sudoers file as NOPASSWD, or create a SUID wrapper to start the services and link to that in Autostart.
_________________
Current Project Thread (myth2avi)
Back to top
View user's profile Send private message
tomekki
n00b
n00b


Joined: 29 May 2007
Posts: 40

PostPosted: Fri Oct 19, 2007 11:53 pm    Post subject: Reply with quote

Thank you for your answers.

@pussi
yes, I do have a script like /etc/init.d/foo which
i am starting manually already.

@pteppic
Good idea. I'll try this.


What is still missing is a hook to run /etc/init.d/foo stop automatically when I stop kde.
Is there something like this?


From my old debian machine I am used to have a runlevel 5 which would cover this scenario.
It was handy to have a separate runlevel just for the xserver.


Greetings Tomekki
Back to top
View user's profile Send private message
pteppic
l33t
l33t


Joined: 28 Nov 2005
Posts: 781

PostPosted: Sat Oct 20, 2007 10:58 am    Post subject: Reply with quote

You can still have a runlevel 5
Code:
mkdir /etc/runlevels/five #make the runlevel directory
for file in /etc/runlevels/default/*;do rc-update add $(basename ${file}) five;done #copy level 3 to 5
sed -i 's/l5:5:wait:/sbin/rc default/l5:5:wait:/sbin/rc five/' #define the new runlevel in inittab
rc-update add <level five only script> five #add extra scripts


You can edit your default runlevel in /.etc/inittab too
Code:
nano /etc/inittab
~~~snip~~~
# Default runlevel.
id:5:initdefault:
~~~snip~~~


As for running things on the exit of KDE, you can kinda fake it by using the System Notifications in kcontrol. There is a 'KDE is exiting' event; in the advanced options you can make it run a command on exit, which can point to a wrapper that starts your exit scripts. I used to use it to shutdown azureus cleanly on logout.

EDIT: Also, I think if you put xdm as a
Code:
depend() {
        need xdm
}
in /etc/init.d/foo, it would get stopped before xdm if you did manually stop xdm.
_________________
Current Project Thread (myth2avi)
Back to top
View user's profile Send private message
tomekki
n00b
n00b


Joined: 29 May 2007
Posts: 40

PostPosted: Sat Oct 20, 2007 11:30 am    Post subject: Reply with quote

Hi pteppic,
nice script :) I managed to set-up a runlevel five with my scripts now.

Thanks!

Tomekki
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum