Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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'm trying to write a simple upstart script for my ubuntu server, which starts vnc4server. But it does not work.

Here's the script:

# vnc-server.conf

start on runlevel [2345]
stop on runlevel [016]

script
        su skerit -c 'vnc4server :0 -geometry 1024x768'
end script

post-stop script
        su skerit -c 'vnc4server -kill :0'
end script

#End of File

The command in the first script block works fine when executing it in the terminal, but running start vnc-server does not have the same effect.

share|improve this question
    
check dmesg for more detail. – accuya Feb 1 '13 at 6:49

Could it be a PATH issue? Try giving the full path to vnc4server in the script. You can find the full path through

which vnc4server

Disclaimer: have not used upstart.

share|improve this answer
    
Hmm, I've changed the command to /usr/bin/vnc4server, but it still does not work. So that's not it I'm afraid. – skerit Mar 20 '12 at 17:28
up vote 0 down vote accepted

Even though the documentation I've read says upstart shouldn't work this way, I had to place the command in a 'post-start script' block in stead of a regular 'script' block.

So:

post-start script
        su skerit -c 'vnc4server :0 -geometry 1024x768'
end script

That did the trick

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .