blob: 29adfa8e36335e66fbd049af9f15e22d80443d74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/net-misc/tightvnc/files/tightvnc.initd,v 1.1 2007/04/12 21:00:48 armin76 Exp $
depend() {
need net
}
checkconfig() {
if [ -n "${DISPLAYS}" ]; then
if [ $1 = "start" ]; then
local user
for user in $DISPLAYS; do
if eval [ ! -f "~${user%%:*}/.vnc/passwd" ]; then
eerror "There are no passwords defined for user ${user%%:*}."
return 1
elif [ -e "/tmp/.X11-unix/X${user##*:}" ]; then
eerror "Display :${user##*:} appears to be already in use because of /tmp/.X11-unix/X${user##*:}"
eerror "Remove this file if there is no X server $HOSTNAME:${user##*:}"
return 1
elif [ -e "/tmp/.X${user##*:}-lock" ]; then
eerror "Display :${user##*:} appears to be already in use because of /tmp/.X${user##*:}-lock"
eerror "Remove this file if there is no X server $HOSTNAME:${user##*:}"
return 1
fi
done
fi
return 0
else
eerror 'Please define $DISPLAYS in /etc/conf.d/vnc'
return 1
fi
}
start() {
checkconfig start || return 1
ebegin "Starting TightVNC server"
for user in $DISPLAYS; do
su ${user%%:*} -c "cd /home/${user%%:*} && vncserver :${user##*:} $VNC_OPTS" &>/dev/null
done
eend $?
}
stop() {
checkconfig stop || return 2
ebegin "Stopping TightVNC server"
for user in $DISPLAYS; do
su ${user%%:*} -c "vncserver -kill :${user##*:}" &>/dev/null
done
eend $?
}
restart() {
svc_stop
svc_start
}
|