This is my first script and when I run it from shell with /usr/local/etc/rc.d/vnc onestart/onestop it works perfectly.
But when the system boots up doesn't work. If I run with start I get the next error:
I've added vnc_enable="YES" to /etc/rc.conf. I was reading the Handbook about rc scripts but I didn't find the solution. I try changing the line with rcvar with other options that I found in other rc scripts but I get the same problem. Here my script
But when the system boots up doesn't work. If I run with start I get the next error:
Code:
Cannot 'start' vnc. Set set_rcvar to YES in /etc/rc.conf or use 'onestart' instead of 'start'
I've added vnc_enable="YES" to /etc/rc.conf. I was reading the Handbook about rc scripts but I didn't find the solution. I try changing the line with rcvar with other options that I found in other rc scripts but I get the same problem. Here my script
Code:
#!/bin/sh
. /etc/rc.subr
name="vnc"
vnc_display=":1"
vnc_options="-name Sesion1VNC -depth 16 -geometry 1024x768 -compatiblekbd -fp '/usr/local/lib/X11/fonts/misc,/usr/local/lib/X11/fonts/75dpi/,/usr/local/lib/X11/fonts/100dpi/'"
rcvar='set_rcvar'
start_cmd="${name}_start"
stop_cmd="${name}_stop"
load_rc_config $name
eval "${rcvar}=\${${rcvar}-'NO'}"
vnc_msg=${vnc_msg:-"Iniciando servidor VNC ..."}
vnc_start(){
echo "$vnc_msg"
su Carleos -c "PATH=$PATH:/home/Carleos"
su Carleos -c "vncserver ${vnc_display} ${vnc_options}"
}
vnc_stop () {
echo -n $"Cerrando servidor VNC ... "
su Carleos -c "vncserver -kill :1"
}
run_rc_command "$1"