How do I create a system-wide autostart file? This would be on a cloud server running the desktop version of Maverick.
I logged in as root and created an autostart file using System/Preferences/StartupApplications
but it ended up in /root/.config/autostart
and did not execute (as far as I can tell) upon rebooting. The autostart file is to invoke a bash script that invokes the VNC server.
I copied the .desktop autostart file from /root/.config/autostart
to /etc/xdg/autostart
and rebooted. This did not seem to make a difference.
Edit As mentioned in a comment, the objective is to run my bash script which starts the VNC server upon boot; not upon a login.
First, install the TightVNC server
sudo apt-get install tightvncserver
.Set up the VNC server for the user you wish to log in as. When you run "vncserver" for the first time, it will ask you to set a password. only allow SSH tunnelled or VPN connections. To launch programs or a session when your VNC session starts, modify
~/.vnc/xstartup
. Here is an example.Copy the following into
/etc/init.d/vncserver
. The easiest way to do it is to copy it to your clipboard, runsudo -i && cat > /etc/init.d/vncserver && exit
in a terminal, paste it in, and type CTRL-D. Be sure to change the USER variable to whatever user you want the VNC server to run under.Make the script executable with
sudo chmod +x /etc/init.d/vncserver
.Source
One possibility: /etc/rc.local
The content says it:
The execution bits are set to 755 on my system already. (chmod 755 /etc/rc.local)
You can put any command in there, which will be executed as root.
This is ok for your purpose as long as you do not change runlevels, I guess. (If you do not know what runlevels are, nevermind).
this seems to be an old post but the topic might be still interesting for some users. To have vnc to start at boot up, you will need to
Step 1 - install x11vnc server
from a command line, type
To add security, you should set a pwd
Step 2 - Configure your startup script
you create the config file under
/etc/init.d/x11vnc.conf
and populate it with the correct commands to be executedthese systems are using systemd and you will need to create your service unit file under
/lib/systemd/system/x11vnc.service
and populate it with the correct commands to be executedReload the service
You can find detailed information on Help Ubuntu Community wiki page (see here) or you can try to use this quick to use recipice
Hope this is helpful
If you're using TigerVNC then it installs
/etc/init.d/vncserver
which starts all vncservers configured in/etc/sysconfig/vncservers
E.g. following would start 2 instances on display 1 & 2 at start up.Add the below line to crontab file. This means the command after the keyword
@reboot
gets executed during very reboot.To open crontab file, need to use the command
crontab -e
You can have cron start stuff for you at boot time. Just use the string "@reboot" in place of the numbers that you normally use to specify when the thing should run.
For example, here's how I start Dropbox on a machine on which it doesn't otherwise start automatically:
'sudo update-rc.d vncserver defaults' reported that there was missing; "Required-Stop:" (even empty). So I added it like below. And no more warning.