diff options
author | onefang | 2019-05-23 21:50:45 +1000 |
---|---|---|
committer | onefang | 2019-05-23 21:50:45 +1000 |
commit | 53baef9042cb30d29a66933da105029101b455d3 (patch) | |
tree | 0710e1a0bfdb3b92c2daa65e2eb28558295e6f5a /scripts | |
parent | Update the tmux config. (diff) | |
download | opensim-SC_OLD-53baef9042cb30d29a66933da105029101b455d3.zip opensim-SC_OLD-53baef9042cb30d29a66933da105029101b455d3.tar.gz opensim-SC_OLD-53baef9042cb30d29a66933da105029101b455d3.tar.bz2 opensim-SC_OLD-53baef9042cb30d29a66933da105029101b455d3.tar.xz |
Management scripts encounters the real world, needs patching up.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/install/secure.sh | 4 | ||||
-rwxr-xr-x | scripts/show-console | 2 | ||||
-rwxr-xr-x | scripts/start-sim | 24 |
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 | |||
18 | sudo chmod ug+rwx ${OS_PATH}/config | 18 | sudo chmod ug+rwx ${OS_PATH}/config |
19 | sudo chmod g+s ${OS_PATH}/config | 19 | sudo chmod g+s ${OS_PATH}/config |
20 | sudo chmod 600 ${OS_PATH}/config/*.ini | 20 | sudo chmod 600 ${OS_PATH}/config/*.ini |
21 | |||
22 | chmod ug+rwx ${OS_PATH}/caches | ||
23 | chmod o-rwx ${OS_PATH}/caches | ||
24 | chmod 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 | ||
3 | tmux -S /var/run/opensim/opensim-tmux.socket select-window -t "OpenSim_console" \; attach-session -t "OpenSim_console" | 3 | tmux -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 | |||
4 | getPrgDir | 4 | getPrgDir |
5 | 5 | ||
6 | USER=$(whoami) | 6 | USER=$(whoami) |
7 | console_name="OpenSim_console" | 7 | console_name="OpenSimSC_console" |
8 | tmux_command="tmux -S /var/run/opensim/opensim-tmux.socket" | 8 | tmux_command="tmux -S ${PRGDIR}/../../caches/opensim-tmux.socket" |
9 | tmux_session=${console_name} | 9 | tmux_session=${console_name} |
10 | tmux_window="${tmux_command} select-window -t ${tmux_session}" | 10 | tmux_window="${tmux_command} select-window -t ${tmux_session}" |
11 | tmux_send="${tmux_command} send-keys -t ${tmux_session}" | 11 | tmux_send="${tmux_command} send-keys -t ${tmux_session}" |
@@ -22,11 +22,11 @@ function wait_for_text() | |||
22 | done | 22 | done |
23 | } | 23 | } |
24 | 24 | ||
25 | if [ $USER = "opensim" ] | 25 | if [ $USER = "${OS_USER}" ] |
26 | then | 26 | then |
27 | SUDO="" | 27 | SUDO="" |
28 | else | 28 | else |
29 | SUDO="sudo -Hu opensim" | 29 | SUDO="sudo -Hu ${OS_USER}" |
30 | fi | 30 | fi |
31 | 31 | ||
32 | if [ "$1" = "-q" ] | 32 | if [ "$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." |