Unable to execute two commands in Startup Applications
772
I was using indicator-stickynotes command in Startup applications which worked fine. I modified it to sleep 30;indicator-sticknotes. I read this in different articles and even on this site. But this isn't working for mine.
Whenever startup applications are defined, it creates a desktop entry in ~/.config/autostart. So, it's a desktop entry which is responsible for launching an application at startup.
On a typical command line (terminal) you can use one of the following to execute two commands.
But desktop entries are very much different from the command line. According to Desktop Entry Specification:
The Exec key
The Exec key must contain a command line. A command line consists of an executable program optionally followed by one or more arguments.
Therefore only one command can be used in Desktop entries. Since you are using two commands, it'll eventually result in errors. Either desktop entry will fail to launch the application or the second command will be considered as an argument to the first command.
You can use sh/bash as a command for this, like:
sh -c "sleep 30; indicator-stickynotes"
As pointed out by ElementW in one of their comment, sleep 30; exec indicator-stickynotes would save a little memory and a PID, since sh is otherwise only waiting on indicator-stickynotes, its child process, to terminate, and serves no other purpose.
Whenever startup applications are defined, it creates a desktop entry in ~/.config/autostart. So, it's a desktop entry which is responsible for launching an application at startup.
On a typical command line (terminal) you can use one of the following to execute two commands.
But desktop entries are very much different from the command line. According to Desktop Entry Specification:
Therefore only one command can be used in Desktop entries. Since you are using two commands, it'll eventually result in errors. Either desktop entry will fail to launch the application or the second command will be considered as an argument to the first command.
You can use sh/bash as a command for this, like:
As pointed out by ElementW in one of their comment,
sleep 30; exec indicator-stickynotes
would save a little memory and a PID, since sh is otherwise only waiting on indicator-stickynotes, its child process, to terminate, and serves no other purpose.