-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjvncall
More file actions
executable file
·39 lines (33 loc) · 908 Bytes
/
jvncall
File metadata and controls
executable file
·39 lines (33 loc) · 908 Bytes
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
#!/usr/local/bin/cbsd
#v12.1.1
MYARG="mode"
MYOPTARG=""
MYDESC="Mass start or stop VNC server for active jail"
ADDHELP="mode=run, stop, status\n"
. ${subrdir}/nc.subr
. ${subrdir}/system.subr
. ${subrdir}/tools.subr
. ${subrdir}/strings.subr
. ${cbsdinit}
active_jname=$( cbsdsqlro local SELECT jname FROM jails WHERE emulator=\"jail\" AND status=\"1\" 2>/dev/null | ${XARGS_CMD} )
[ -z "${active_jname}" ] && err 1 "${N1_COLOR}No active jail ;-(${N0_COLOR}"
case "${mode}" in
run)
for i in ${active_jname}; do
${ECHO} "${N1_COLOR}Starting VNC for: ${N2_COLOR}${i}${N0_COLOR}"
vncterm jname=${i} mode=run addr=127.0.0.1
sleep 2
done
;;
stop)
for i in ${active_jname}; do
${ECHO} "${N1_COLOR}Starting VNC for: ${N2_COLOR}${i}${N0_COLOR}"
vncterm jname=${i} mode=stop
sleep 2
done
;;
*)
err 1 "${N1_COLOR}Please set mode to 'run' or 'stop'${N0_COLOR}"
;;
esac
exit 0