Starting x11vnc from init.d in jessie
Posted by valqk on
I've spent last hour trying to make a descent init.d script 'new way' that's working properly so I can have x11vnc started at boot time.
Here it is:
Here it is:
#!/bin/sh ### BEGIN INIT INFO # Provides: x11vnc # Should-Start: # Required-Start: gdm3 # Required-Stop: # Default-Start: 5 # Default-Stop: 0 1 2 6 # Short-Description: x11vnc server # Description: Debian init script for the x11vnc server ### END INIT INFO # # Author: Anton Valqkoff < anton valqk com > # set -e PATH=/sbin:/bin:/usr/sbin:/usr/bin SERVICE=$(basename $0) PIDFILE="/var/run/$SERVICE.pid" BIN=/usr/bin/x11vnc OPT=" -display :0 -auth guess -rfbauth /etc/x11vncpassword -oa /var/log/vnc.log -xkb -forever" test -x $BIN || exit 0 if [ -r /etc/default/locale ]; then . /etc/default/locale export LANG LANGUAGE fi . /lib/lsb/init-functions case "$1" in start) CONFIGURED_DAEMON=$(basename "$(cat $DEFAULT_DISPLAY_MANAGER_FILE 2> /dev/null)") if [ `ps ax|grep $SERVICE|grep -v grep|wc -l` -gt 1 ]; then log_daemon_msg "Starting $SERVICE server" "$SERVICE" set +e start-stop-daemon --start --pidfile $PIDFILE -m --background --exec $BIN -- $OPT || log_end_msg 1 log_end_msg 0 set -e else log_daemon_msg "$SERVICE Already started..." "$SERVICE" fi ;; stop) log_daemon_msg "Stopping $SERVICE" "$SERVICE" set +e start-stop-daemon --stop --quiet --pidfile $PIDFILE \ --name $SERVICE --retry 5 set -e log_end_msg $? ;; reload) log_daemon_msg "Scheduling reload of $SERVICE" "$SERVICE" set +e start-stop-daemon --stop --signal HUP --quiet --pidfile $PIDFILE \ --name $SERVICE set -e log_end_msg $? ;; status) status_of_proc -p "$PIDFILE" "$BIN" $SERVICE && exit 0 || exit $? ;; restart|force-reload) $0 stop $0 start ;; *) echo "Usage: $0 {start|stop|restart|reload|force-reload|status}" exit 1 ;; esac exit 0
Trackbacks
Trackback specific URI for this entryThis link is not meant to be clicked. It contains the trackback URI for this entry. You can use this URI to send ping- & trackbacks from your own blog to this entry. To copy the link, right click and select "Copy Shortcut" in Internet Explorer or "Copy Link Location" in Mozilla.
No Trackbacks
Comments
Display comments as Linear | ThreadedNo comments