aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts
diff options
context:
space:
mode:
authoronefang2019-05-23 21:50:45 +1000
committeronefang2019-05-23 21:50:45 +1000
commit53baef9042cb30d29a66933da105029101b455d3 (patch)
tree0710e1a0bfdb3b92c2daa65e2eb28558295e6f5a /scripts
parentUpdate the tmux config. (diff)
downloadopensim-SC-53baef9042cb30d29a66933da105029101b455d3.zip
opensim-SC-53baef9042cb30d29a66933da105029101b455d3.tar.gz
opensim-SC-53baef9042cb30d29a66933da105029101b455d3.tar.bz2
opensim-SC-53baef9042cb30d29a66933da105029101b455d3.tar.xz
Management scripts encounters the real world, needs patching up.
Diffstat (limited to '')
-rwxr-xr-xscripts/install/secure.sh4
-rwxr-xr-xscripts/show-console2
-rwxr-xr-xscripts/start-sim24
3 files changed, 17 insertions, 13 deletions
diff --git a/scripts/install/secure.sh b/scripts/install/secure.sh
index 48255b6..43ed679 100755
--- a/scripts/install/secure.sh
+++ b/scripts/install/secure.sh
@@ -18,3 +18,7 @@ sudo chmod a+x ${OS_PATH}/current/scripts/start-sim
18sudo chmod ug+rwx ${OS_PATH}/config 18sudo chmod ug+rwx ${OS_PATH}/config
19sudo chmod g+s ${OS_PATH}/config 19sudo chmod g+s ${OS_PATH}/config
20sudo chmod 600 ${OS_PATH}/config/*.ini 20sudo chmod 600 ${OS_PATH}/config/*.ini
21
22chmod ug+rwx ${OS_PATH}/caches
23chmod o-rwx ${OS_PATH}/caches
24chmod g+s ${OS_PATH}/caches
diff --git a/scripts/show-console b/scripts/show-console
index ddeba86..5818e70 100755
--- a/scripts/show-console
+++ b/scripts/show-console
@@ -1,3 +1,3 @@
1#!/bin/bash 1#!/bin/bash
2 2
3tmux -S /var/run/opensim/opensim-tmux.socket select-window -t "OpenSim_console" \; attach-session -t "OpenSim_console" 3tmux -S ../../caches/opensim-tmux.socket select-window -t "OpenSimSC_console" \; attach-session -t "OpenSimSC_console"
diff --git a/scripts/start-sim b/scripts/start-sim
index e82547a..3c6370f 100755
--- a/scripts/start-sim
+++ b/scripts/start-sim
@@ -4,8 +4,8 @@ source common.sh
4getPrgDir 4getPrgDir
5 5
6USER=$(whoami) 6USER=$(whoami)
7console_name="OpenSim_console" 7console_name="OpenSimSC_console"
8tmux_command="tmux -S /var/run/opensim/opensim-tmux.socket" 8tmux_command="tmux -S ${PRGDIR}/../../caches/opensim-tmux.socket"
9tmux_session=${console_name} 9tmux_session=${console_name}
10tmux_window="${tmux_command} select-window -t ${tmux_session}" 10tmux_window="${tmux_command} select-window -t ${tmux_session}"
11tmux_send="${tmux_command} send-keys -t ${tmux_session}" 11tmux_send="${tmux_command} send-keys -t ${tmux_session}"
@@ -22,11 +22,11 @@ function wait_for_text()
22 done 22 done
23} 23}
24 24
25if [ $USER = "opensim" ] 25if [ $USER = "${OS_USER}" ]
26then 26then
27 SUDO="" 27 SUDO=""
28else 28else
29 SUDO="sudo -Hu opensim" 29 SUDO="sudo -Hu ${OS_USER}"
30fi 30fi
31 31
32if [ "$1" = "-q" ] 32if [ "$1" = "-q" ]
@@ -80,7 +80,7 @@ case $(basename $0) in
80 cmd="mono ${exe}.exe -inidirectory=../../config/${tgt} " 80 cmd="mono ${exe}.exe -inidirectory=../../config/${tgt} "
81 81
82 # Check if it's already running. 82 # Check if it's already running.
83 if [ -e /var/run/opensim/${tgt}.pid ] 83 if [ -e ${PRGDIR}/../../caches/${tgt}.pid ]
84 then 84 then
85 # Double check if it's REALLY running. 85 # Double check if it's REALLY running.
86 if [ "x$(ps -p $(cat ${PRGDIR}/../../caches/${tgt}.pid) --no-headers -o comm)" = "x" ]; then 86 if [ "x$(ps -p $(cat ${PRGDIR}/../../caches/${tgt}.pid) --no-headers -o comm)" = "x" ]; then
@@ -88,12 +88,12 @@ case $(basename $0) in
88 fi 88 fi
89 fi 89 fi
90 # Now see if it's really really running. lol 90 # Now see if it's really really running. lol
91 if [ ! -e /var/run/opensim/${tgt}.pid ] 91 if [ ! -e ${PRGDIR}/../../caches/${tgt}.pid ]
92 then 92 then
93 if [ "x$tgt" = "xROBUST" ]; then 93 if [ "x$tgt" = "xROBUST" ]; then
94# TODO - the problem here is that the > bit is executed as onefang, not as opensim. 94# TODO - the problem here is that the > bit is executed as the user, not as opensim.
95 $SUDO cat ${PRGDIR}/../../config/config.ini ${PRGDIR}/../../config/Robust.ini.template >${PRGDIR}/../../config/Robust.ini 95 $SUDO cat ${PRGDIR}/../../config/config.ini ${PRGDIR}/../../config/Robust.ini.template >${PRGDIR}/../../config/Robust.ini
96# $SUDO chown -R opensim:opensim ${PRGDIR}/../../config/Robust.ini 96# $SUDO chown -R ${OS_USER}:${OS_USER} ${PRGDIR}/../../config/Robust.ini
97 chmod 640 ${PRGDIR}/../../config/Robust.ini 97 chmod 640 ${PRGDIR}/../../config/Robust.ini
98 ${tmux_command} split-window -hp 50 -t "${tmux_session}:" "${cmd}" 98 ${tmux_command} split-window -hp 50 -t "${tmux_session}:" "${cmd}"
99 else 99 else
@@ -124,7 +124,7 @@ case $(basename $0) in
124 ;; 124 ;;
125 125
126 "backup-sim") 126 "backup-sim")
127 if [ -e /var/run/opensim/${tgt}.pid ]; then 127 if [ -e ${PRGDIR}/../../caches/${tgt}.pid ]; then
128 cd ${PRGDIR} 128 cd ${PRGDIR}
129 $SUDO ${PRGDIR}/gitAR.sh o "${title}" 129 $SUDO ${PRGDIR}/gitAR.sh o "${title}"
130 sim=$(sanitize "${title}") 130 sim=$(sanitize "${title}")
@@ -141,7 +141,7 @@ case $(basename $0) in
141 ;; 141 ;;
142 142
143 "stop-sim") 143 "stop-sim")
144 if [ -e /var/run/opensim/${tgt}.pid ]; then 144 if [ -e ${PRGDIR}/../../caches/${tgt}.pid ]; then
145 ${tmux_send}:"${title}" "alert WARNING - Emergency shutdown in one minute!" Enter 145 ${tmux_send}:"${title}" "alert WARNING - Emergency shutdown in one minute!" Enter
146 ${tmux_send}:"${title}" "alert WARNING - Emergency shutdown in one minute!" Enter 146 ${tmux_send}:"${title}" "alert WARNING - Emergency shutdown in one minute!" Enter
147 sleep 30 147 sleep 30
@@ -150,9 +150,9 @@ case $(basename $0) in
150 sleep 30 150 sleep 30
151 ${tmux_send}:"${title}" "shutdown" Enter 151 ${tmux_send}:"${title}" "shutdown" Enter
152 sleep 30 152 sleep 30
153 if [ -e /var/run/opensim/${tgt}.pid ]; then 153 if [ -e ${PRGDIR}/../../caches/${tgt}.pid ]; then
154 echo "Killing it with extreme prejudice!" 154 echo "Killing it with extreme prejudice!"
155 kill -TERM `cat /var/run/opensim/${tgt}.pid` 155 kill -TERM `cat ${PRGDIR}/../../caches/${tgt}.pid`
156 fi 156 fi
157 else 157 else
158 echo "Sim ${title} is not running, so not stopping." 158 echo "Sim ${title} is not running, so not stopping."