How to autostart multiple commands within one?

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?


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.


In Autostart, multiple commands can run in sequence if a shell executes them:

Exec=bash -c "cmd1 ; cmd2 ; cmd3"

Or in your case:

Exec=bash -c "sleep 3s;cd /home/user/programdir/lpfw/;gksudo ./lpfwpygui"

This likely also works with other shells than bash, but with other syntax.