1

Starting tightvncserver manually from a terminal works fine. To start it @reboot I am using crontab -e with the following command:

@reboot sleep 20 && /usr/bin/tightvncserver

The path is correct, I tested it using which tightvncserver, but it does not work. I am new to cron, so I do not have experience. What comes to my mind, that there is trouble with the users. Cron does not know, which user should execute this command.

Any help is appreciated!

  • See raspberrypi.stackexchange.com/a/39374/8697 - while this mentions Jessie it works with Stretch (or any systemd OS). – Milliways Jan 20 '18 at 23:12
  • @Milliways: Thank you very much for your link. This line in cron "at"reboot sudo -u pi /usr/bin/tightvncserver" works for me, but I am not really happy with it. Tightvncserver is an executable which is able to work without sudo. However, "at"reboot -u pi /usr/bin/tightvncserver or "at"reboot pi /usr/bin/tightvncserver, "at"reboot /usr/bin/tightvncserver do not work. – cerv21 Jan 21 '18 at 15:11
  • @Milliways: Edit: su is what I want. I only knew that su is used for root, but I was not familiar with its options. – cerv21 Jan 21 '18 at 15:14
0

You can start tightvncserver at startup by adding the line into /etc/rc.local.

rc.local starts after all the services are up after the OS start.

Here is rc.local from Raspberry pi documentation.

  • Thank you, but I would like to use cron. I something goes wrong, I have to replace @reboot with some interval of time, such that cron seems to be the better option for me. – cerv21 Jan 21 '18 at 15:06
  • @opens rc.local is your best option but if you want to use some other option, it will be your choice. As you have already mentioned you have tried to use cron but it did not function for you. – Chetan Bhargava Jan 22 '18 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.