I have modified the sudoers file with sudo visudo and added 2 lines to it:
tiamo ALL = NOPASSWD: /home/tiamo/myscript.sh tiamo ALL = NOPASSWD: /usr/bin/command
I have then added my script to "Startup Applications" like so:
bash -c "sleep 1m;gksu /home/tiamo/myscript.sh"
myscript.sh looks like this:
do some non sudo stuff do sudo command while true do launch a program sleep 15m kill the program done
After I reboot Ubuntu I open a terminal and use
pgrep myscript, it reveals that it is running and its pid. However, the program it is supposed to launch is not active, so I assume that it gets stuck on the sudo command which I have added to my sudoers file.
Any clue why it gets stuck?
SOLVED like so:
Added the sudo commands to my /etc/rc.local. Launch my script in startup applications like
gnome-terminal -e ./myscript.sh. The output of the script is now redirected to a new terminal, and it executes successfully.