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 want to autostart a program with multiple commands within one.

Here are my 3 separate commands:

sleep 3s
cd /home/user/programdir/lpfw/
gksudo ./lpfwpygui

My command is sleep 3s;cd /home/user/programdir/lpfw/;gksudo ./lpfwpygui.

It works fine if run manually from terminal, but I can't get it to work from autostart entry.

Any ideas?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Try making a script with your commands and running the script from the autostart entry:

#!/bin/sh

sleep 3s
cd /home/user/programdir/lpfw
gksudo ./lpfwpygui

You should also try sleeping for longer, 3s may not be enough for the Desktop Environment to finish loading and that could cause problems since you are using gksudo.

share|improve this answer
    
thanks for replying; one thing is the program doesn't run if gksudo /home/user/programdir/lpfw/lpfwpygui but will run after cd to parent dir and then gksudo ./ that's weird –  Yopbot Dec 2 '12 at 17:11
    
@user177480, OK, changed the script. So, does it work if your autostart entry calls the script? Does it work if you increase the sleep time? –  terdon Dec 2 '12 at 17:22
    
yes all good thanks a lot; do you have any idea why it doesn't work if i type "gksudo /path/script" while it works if i cd first and then gksudo? –  Yopbot Dec 2 '12 at 17:28
    
@user177480, not really no. Some kind of security feature probably but I don't know. Also, while thanks are always appreciated, the standard way of thanking people on the stackexchange network is to upvote and/or accept their answer (the check mark to the left of an answer). –  terdon Dec 2 '12 at 17:30
    
done ! but i can't upvote as it requires 15 reputation i have only 8 :(, wish i could, sorry –  Yopbot Dec 2 '12 at 17:33

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.