Run init.d script in the context of the current user session.

Posted by akellehe on Server Fault See other posts from Server Fault or by akellehe
Published on 2011-01-02T19:59:48Z Indexed on 2011/01/02 20:55 UTC
Read the original article Hit count: 167

Filed under:

I'd like to run a script in init.d (on Fedora) in the context of the user session I'm logging in as.

I have a script called keyboard_deadkeys I wrote to set some deadkeys on my keyboard. The script is very simple:

#!/bin/bash
/usr/bin/xmodmap /home/julie/keymappings

I put it in the directory /etc/init.d so it will run at boot time. It is also in /etc/rc.d/init.d

I changed the permissions to a+rwx for good measure.

When I boot; the deadkeys aren't set in the user's session. When I then run the script manually; the keys are set.

How can I rectify this?

© Server Fault or respective owner

Related posts about init.d