My goal here is to run the cmatrix script and lock the desktop simultaneously, so that cmatrix will be shown as a screensaver until I come back and unlock the computer.
My script looks like this:
gnome-screensaver-command -l & sudo openvt -ws cmatrix
Now I wanted to make the script be able to run without the need to input the sudo password everytime, so I changed the sudoers file (like this). It is working if I run it in the terminal, so far so good.
Then I added it to the PATH, because I wanted to bind it to the global shortcut Ctrl+Alt+L, but it doesn't work if I invoke it via the shortcut. The desktop just flashes for a split second, like it wanted to show cmatrix, but then it goes straight to the unlock screen.
I figured out that the part with openvt isn't working like it should, even if it is the only thing in the script.
Any ideas how to accomplish what I want?
EDIT: In the split second when the desktop flashes, I managed to read this on the screen:
Error opening terminal: unknown
sudo subefore it, so everything is on the PATH of the root user. – lmazgon Jan 20 '16 at 13:20sudo subecause you gain root privileges withsuand then run it as 'regular' command from root account.sudowon't let you run commands located outside 'secure' path without providing full path to them. E.g. if you put your script on/unsecure/path/scriptand then doexport PATH=/unsecure/path; sudo scriptit won't run, butsudo /unsecure/path/scriptwill. – nsilent22 Jan 20 '16 at 16:21/usr/binor/bin. Anyway, I found the solution, thanks for your input! – lmazgon Jan 20 '16 at 18:16