On Fedora 27 mate, I am trying to execute two lines to make two VNC servers when the computer logs in. But it is only executing the first line. If i split the script into two files it works. Is there a way to have it in one script?
I tried searching for an answer but could not find one, apologies if this is a repost of an already answered question.
The script is made executable by chmod +x and i am using mate-session-properties to make it bootable. The file is on the desktop as startup.sh.
!# /bin/bash
x0vncserver -rfauth ~/.vnc/passwd
vncserver :1 geometry 1024x768 -depth 24
The script is only running the first line because the default behavior is to wait until the program exits and then move to the next line. To move on to the next line without waiting for the first line to finish you need to add a ampersand at the end of the first line, eg
!# /bin/bash
x0vncserver -rfauth ~/.vnc/passwd &
vncserver :1 geometry 1024x768 -depth 24
The above example with run the first line without waiting for it to exit and then wait for the second line to finish before the script exits.