View previous topic :: View next topic |
Author |
Message |
tomekki n00b
Joined: 29 May 2007 Posts: 40
|
Posted: Fri Oct 19, 2007 5:49 pm Post subject: [solved] Howto start a runlevel script after kde is running? |
|
|
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 |
|
|
pussi l33t
Joined: 08 May 2004 Posts: 727 Location: Finland
|
Posted: Fri Oct 19, 2007 6:37 pm Post subject: |
|
|
I'm not sure if I understood correctly but you can simply run something like /etc/init.d/foo start |
|
Back to top |
|
|
pteppic l33t
Joined: 28 Nov 2005 Posts: 781
|
Posted: Fri Oct 19, 2007 7:38 pm Post subject: |
|
|
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 |
|
|
tomekki n00b
Joined: 29 May 2007 Posts: 40
|
Posted: Fri Oct 19, 2007 11:53 pm Post subject: |
|
|
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 |
|
|
pteppic l33t
Joined: 28 Nov 2005 Posts: 781
|
Posted: Sat Oct 20, 2007 10:58 am Post subject: |
|
|
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 |
|
|
tomekki n00b
Joined: 29 May 2007 Posts: 40
|
Posted: Sat Oct 20, 2007 11:30 am Post subject: |
|
|
Hi pteppic,
nice script I managed to set-up a runlevel five with my scripts now.
Thanks!
Tomekki |
|
Back to top |
|
|
|