load x11vnc on startup

Need support for GhostBSD. Ask here if your question does not fit elsewhere.
Post Reply
martinN
Posts: 4
Joined: Mon Apr 13, 2020 9:08 am

load x11vnc on startup

Post by martinN »

what have i done:

sudo pkg install x11vnc
sudo x11vnc -storepasswd /etc/x11vnc.pass
sudo x11vnc -display :0 -rfbauth /etc/x11vnc.pass

and it works fine.

But i can't find a working solution for a startup script for FreeBSD or GhostBSD.
All other Linux scripts are not working here.

Example: sudo systemctl enable x11vnc.service

how can i enable that in GhostBSD?
User avatar
slughorn
Posts: 135
Joined: Mon Oct 02, 2017 2:55 pm

Re: load x11vnc on startup

Post by slughorn »

I hop that the man pages will bring you a step further:
https://www.freebsd.org/cgi/man.cgi?que ... ormat=html
User avatar
ericbsd
Developer
Posts: 2056
Joined: Mon Nov 19, 2012 7:54 pm

Re: load x11vnc on startup

Post by ericbsd »

There is no service for x11vnc in FreeBSD and GhostBSD also systemctl command will not be find on FreeBSD systems.
martinN
Posts: 4
Joined: Mon Apr 13, 2020 9:08 am

Re: load x11vnc on startup

Post by martinN »

Hi ericbsd,
did You mean, there is no way to start x11vnc on boot?
And it is waisting time to follow slughorn?
martinN
Posts: 4
Joined: Mon Apr 13, 2020 9:08 am

Re: load x11vnc on startup

Post by martinN »

Hi slughorn,
thanks for the link. I know about this and similar pages. I use those pages when i want to optimise some exsisting routines.
But in this case i am just a primary schoolboy. I don't know, how to start with building a startup routines for BSD.
I can read text, i can write it to a terminal and then i cont on it to work.
I found a lot of posts with some rc.d-scripting and i think that is the way i have to go.
I found this: https://www.freebsd.org/doc/en_US.ISO88 ... index.html
and i tried point 3, the dummy script, and it worked (after a reboot).
But i have no idea how i get this: "x11vnc -display :0 -rfbauth /etc/x11vnc.pass" to work with a rc.d-script.
I tried this:

#!/bin/sh

. /etc/rc.subr

name="runx11"
start_cmd="${name}_start"
stop_cmd=":"

runx11_start()
{
x11vnc -display :0 -rfbauth /etc/x11vnc.pass
}

load_rc_config $name
run_rc_command "$1"

but that doesn't work.

In this case i need some help.
User avatar
slughorn
Posts: 135
Joined: Mon Oct 02, 2017 2:55 pm

Re: load x11vnc on startup

Post by slughorn »

There are some rules. Please read here https://wiki.ghostbsd.org/index.php/OpenRC
martinN
Posts: 4
Joined: Mon Apr 13, 2020 9:08 am

Re: load x11vnc on startup

Post by martinN »

Hi slughorn,
thanks for the additional informations, but it is really too much for me.
There is only one command line (it works perfect when i type it manually):
"x11vnc -display :0 -rfbport 5900 -localhost -bg -rfbauth /etc/x11vnc.pass"
I found some examples and i edited them, but i had no success.
Is this so ununsual what i'm trying? Or is there a better way to connect to the desktop with a VNC-Viewer?
User avatar
slughorn
Posts: 135
Joined: Mon Oct 02, 2017 2:55 pm

Re: load x11vnc on startup

Post by slughorn »

I'm not a developer yet. But if your command works on the cli, I would try the following steps:
1. Make a shell script "foo" (foo ist a replacement for your script name] and test it
2. Save this skript in the dirctory

Code: Select all

/usr/local/etc/init.d
(There are some examples too, take as an example cupsd in this directory)
3. Make

Code: Select all

chmod +x foo
4. Take [https://wiki.ghostbsd.org/index.php/Rc-update rc-update] and make

Code: Select all

rc-update add foo
With rc-update you can safely add the new service
5. Report me please, if it works
Post Reply