[bug-notifications] [vncserver 0000280]: Start up script has shell run-time errors

Mantis Bug Tracker noreply at opencsw.org
Wed Nov 18 09:10:58 CET 2009


The following issue has been ASSIGNED. 
====================================================================== 
http://www.opencsw.org/mantis/view.php?id=280 
====================================================================== 
Reported By:                scs1ng
Assigned To:                maciej
====================================================================== 
Project:                    vncserver
Issue ID:                   280
Category:                   regular use
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             2004-03-07 19:02 CET
Last Modified:              2009-11-18 09:10 CET
====================================================================== 
Summary:                    Start up script has shell run-time errors
Description: 
The script /etc/init.d/cswvncserver  gives shell errors both when starting
and stopping.  

Details:
The config script /opt/csw/etc/vncservers was edited so that the last two
lines are:

VNCSERVERS=\"1:scs1ng\"
ARGS=\"-geometry 1024x768 -alwaysshared\"

Running /etc/init.d/cswvncserver stop gives:

Shutting down VNC server: 
1:scs1ng 
Ambiguous output redirect

and /etc/init.d/cswvncserver start gives

Starting VNC server: 
1:scs1ng 
Missing ]


====================================================================== 

---------------------------------------------------------------------- 
 (0004467) davecb (reporter) - 2007-03-23 09:18
 http://www.opencsw.org/mantis/view.php?id=280#c4467 
---------------------------------------------------------------------- 
Ok, here\'s an rc3.d script that works on Solaris, using only sh instead of
bash: --Dave Collier-Brown <davecb at spamcop.net>
 
hobbes> cat S92cswvncserver 
#!/bin/sh
#
# S92cswvncserver -- Starts and stops vncserver. 
#       used to provide remote X window systems access to
#       machines which only have (PC) VNC available.
#set -x
VNCSERVERS=\"\"
ARGS=\"\"

main() {
        chmod 01777 /tmp/.X11-unix  # Permit non-root access
        
        if [ -f /opt/csw/etc/vncservers ] ; then
                . /opt/csw/etc/vncservers
        else
                say \"$0: no servers to start in
/opt/csw/etc/vncservers\"
                exit 0
        fi
        
        # See how we were called.
        case \"$1\" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        restart|reload)
                stop
                start
                ;;
        condrestart)
                if [ -f /var/spool/locks/vncserver ]; then
                        stop
                        start
                fi
                ;;
        stat*)
                pgrep -l vnc
                ;;
        *)
                echo $\"Usage: $0
{start|stop|status|restart|condrestart}\"
                exit 1
        esac
}

start() {
        echo \"Starting VNC server: \"
        ulimit -c 0 >/dev/null 2>&1
        rc=0
        for token in ${VNCSERVERS}; do
                echo \"${token} \"
                display=`echo $token | sed \'s/:.*$//\'`
                user=`echo $token | sed \'s/^.*://\'`
                su - ${user} -c \"
                        cd 
                        if [ ! -f .vnc/passwd ] 
                                say \"$0: $user lacks a .vnc/password
file, skipped\"
                        else

                                USER=$user /opt/csw/bin/vncserver ${ARGS}
:${display}
                        fi
                \"
                rc=$?
                if [ \"$rc\" -ne 0 ]; then
                        break
                fi
        done
        if [ \"$rc\" -eq 0 ]; then
                touch /var/spool/locks/vncserver
        fi
}

stop() {
        echo \"Shutting down VNC server: \"
        for token in ${VNCSERVERS}; do
                echo \"${token} \"
                display=`echo $token | sed \'s/:.*$//\'`
                user=`echo $token | sed \'s/^.*://\'`
                su ${user} -c \"USER=$user /opt/csw/bin/vncserver
-kill :${display}\"
                rc=$?
        done
        if [ \"$rc\" -eq 0 ]; then
                rm -f /var/spool/locks/vncserver
        fi
}

say() {
        echo \"$@\" 1>&2
}

main \"$@\"
exit 0




More information about the bug-notifications mailing list