#!/bin/sh ### BEGIN INIT INFO # Provides: vnc-ecdemo # Required-Start: networking # Required-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: VNC for EcdemoConnect project # Description: Starts a VNC session at :5 to manage EuropeanaConnect server # for shared interactive management ### END INIT INFO set -e DAEMON=/srv/ecdemo/bin/server VNC_ENABLE=true VNC_DISPLAY=5 VNC_DEFAULTS_FILE=/etc/default/vnc VNC_CONFIG_FILE=/etc/vnc.conf VNC_USER=ecdemo test -x $DAEMON || exit 0 . /lib/lsb/init-functions . /etc/default/rcS if [ -s $VNC_DEFAULTS_FILE ]; then . $VNC_DEFAULTS_FILE case "x$VNC_ENABLE" in xtrue|xfalse) ;; *) log_failure_msg "Value of VNC_ENABLE in $VNC_DEFAULTS_FILE must be either 'true' or 'false';" log_failure_msg "not starting $VNC_USER daemon." exit 1 ;; esac fi check() { /usr/local/bin/lsvnc | grep -qw $VNC_USER } case "$1" in start) if "$VNC_ENABLE"; then log_daemon_msg "Starting $VNC_USER server" if check; then log_daemon_msg "$VNC_USER server is already running." log_end_msg 1 exit fi rm -f /tmp/.X11-unix/X$VNC_DISPLAY su $VNC_USER -c "cd /srv/$VNC_USER && bin/server :$VNC_DISPLAY" log_end_msg $? fi ;; stop) log_daemon_msg "Shutting down $VNC_USER server" su $VNC_USER -c "vncserver -kill :$VNC_DISPLAY" log_end_msg $? ;; try-restart) $0 status >/dev/null && $0 restart log_end_msg 0 ;; restart) $0 stop $0 start log_end_msg 0 ;; reload|force-reload) $0 restart ;; status) log_daemon_msg "Checking for $VNC_USER server: " if check; then log_daemon_msg "running" else log_daemon_msg "not running" fi log_end_msg 0 ;; *) echo "Usage: $0 {start|stop|try-restart|restart|reload|force-reload|status}" exit 1 ;; esac