Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wrote a script which greps through the output of synclient to determine whether a laptop's touchpad has miraculously turned itself off (Ubuntu seems to /love/ doing this recently) and, if so, turns it back on.

The script is something like this:

while true ; do
    if [ `synclient | grep -e"TouchpadOff[\s]*1" | wc -l` -ge 1 ] ; then
        synclient TouchpadOff=0

(I don't have the laptop to hand right now but you get the point! I will update later when I'm at my laptop if that's incorrect)

So I tried running this as an upstart script so my touchpad can heal itself without any interaction. But it seems synclient doesn't find the current user's X session when my script is upstart'ed.

I tried running it by using something like su -c ledneb in my script stanza, but to no avail.

Should I be looking in the direction of /etc/X11/xinit/xinitrc rather than upstart?

Is there a proper way to have this script run in the context of the current (or even a hard-coded) user's x session?

share|improve this question

You can do what you are asking...

... but I'm not sure this is the right approach. If you have not already done so, please consider reporting the issue in Ubuntu so it can be fixed as the behaviour you describe sounds like a bug.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.