Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

2 Answers 2

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

Your Answer

 
discard

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.