From 553748e76cbbf18ae9d29b3d081a3b44aff7474e Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 20 May 2019 20:10:57 +1000 Subject: Initial tweaks of the installation stuff. --- scripts/fix_var_run.sh | 6 ------ 1 file changed, 6 deletions(-) delete mode 100755 scripts/fix_var_run.sh (limited to 'scripts') diff --git a/scripts/fix_var_run.sh b/scripts/fix_var_run.sh deleted file mode 100755 index 97567cb..0000000 --- a/scripts/fix_var_run.sh +++ /dev/null @@ -1,6 +0,0 @@ -# Create the opensim run dir. -mkdir -p /var/run/opensim -chown opensim:opensim /var/run/opensim -chmod ug+rwx /var/run/opensim -chmod o-rwx /var/run/opensim -chmod g+s /var/run/opensim -- cgit v1.1 From 8723177732fe0843116a81b5c935cb440799e243 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 21 May 2019 04:41:57 +1000 Subject: Move install related scripts and stuff into their own directory. --- scripts/create_sim.sh | 96 -------------------------------------- scripts/go_live.sh | 12 ----- scripts/group_migrate.sql | 48 ------------------- scripts/install/create_sim.sh | 96 ++++++++++++++++++++++++++++++++++++++ scripts/install/go_live.sh | 12 +++++ scripts/install/group_migrate.sql | 48 +++++++++++++++++++ scripts/install/opensim-monit.conf | 36 ++++++++++++++ scripts/install/opensim.tmux.conf | 52 +++++++++++++++++++++ scripts/opensim-monit.conf | 36 -------------- scripts/opensim.tmux.conf | 52 --------------------- 10 files changed, 244 insertions(+), 244 deletions(-) delete mode 100755 scripts/create_sim.sh delete mode 100755 scripts/go_live.sh delete mode 100644 scripts/group_migrate.sql create mode 100755 scripts/install/create_sim.sh create mode 100755 scripts/install/go_live.sh create mode 100644 scripts/install/group_migrate.sql create mode 100644 scripts/install/opensim-monit.conf create mode 100644 scripts/install/opensim.tmux.conf delete mode 100644 scripts/opensim-monit.conf delete mode 100644 scripts/opensim.tmux.conf (limited to 'scripts') diff --git a/scripts/create_sim.sh b/scripts/create_sim.sh deleted file mode 100755 index 0681067..0000000 --- a/scripts/create_sim.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/bash - -source common.sh -getPrgDir - -NAME=$1 -LOCATION=$2 -URL=$3 -IP=$4 -SIZE=$5 - -OSPATH="/opt/opensim" -cd $OSPATH/config - -k=0 -for i in $(seq -w 1 99) -do - j=$(num2name "$i") - if [ -e "$j" ] - then - k=$i - fi -done - -if [ "x$NAME" = "x" ] -then - NAME="No name sim $RANDOM" # Should be unique per grid. - echo "WARNING setting the sim name to [$NAME], this may not be what you want." -fi -# Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows. -sim=$(sanitize $NAME) - -if [ "x$LOCATION" = "x" ] -then - LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case! - echo "WARNING setting the Location to $LOCATION, this may not be what you want." -fi - -if [ "x$IP" = "x" ] -then - # 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP. - IP="0.0.0.0" - echo "WARNING setting the InternalAddress to $IP, this may not be what you want." -# echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." -# According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. -fi - -if [ "x$URL" = "x" ] -then -# Here we make use of an external IP finding service. Careful, it may move. -# URL=$(wget -q http://automation.whatismyip.com/n09230945.asp -O -) # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too. - URL="SYSTEMIP" - echo "WARNING setting the ExternalHostName to $URL, this may not be what you want." -fi - -if [ "x$SIZE" = "x" ] -then - SIZE="256" -fi - -# Wow, the hoops we have to jump through to avoid octal. -if [ 9 -gt $k ]; then - NUM=$(printf '0%1s' $(( 10#$k + 1 )) ) -else - NUM=$(printf '%2s' $(( 10#$k + 1 )) ) -fi - -PORT=$(( 9005 + (10#$k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. -UUID=$(uuidgen) - -echo "Creating sim$NUM on port $PORT @ $LOCATION - $NAME." - -cp -r sim_skeleton sim$NUM - -cd sim$NUM -mv My_sim.xml ${sim}.xml -sed -i "s@SIM_NAME@$NAME@g" ${sim}.xml -sed -i "s@SIM_UUID@$UUID@g" ${sim}.xml -sed -i "s@SIM_POS@$LOCATION@g" ${sim}.xml -sed -i "s@SIM_IP@$IP@g" ${sim}.xml -sed -i "s@SIM_INT_PORT@$(( $PORT + 1 ))@g" ${sim}.xml -sed -i "s@SIM_URL@$URL@g" ${sim}.xml -sed -i "s@SIM_SIZE@$SIZE@g" ${sim}.xml - -ln -s ../../current/scripts/common.sh common.sh -ln -s ../../current/scripts/start-sim start-sim -cp -P start-sim backup-sim -cp -P start-sim stop-sim - -sed -i "s@SIM_NUMBER@$NUM@g" ThisSim.ini -sed -i "s@SIM_PORT@$PORT@g" ThisSim.ini - -sed -i "s@SIM_NUMBER@$NUM@g" opensim-monit.conf - -sudo chown -R opensim:opensim .. -sudo chmod -R g+w .. diff --git a/scripts/go_live.sh b/scripts/go_live.sh deleted file mode 100755 index 21d7072..0000000 --- a/scripts/go_live.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -OSPATH="/opt/opensim" - -for i in $(seq 99) -do - j=$(printf "sim%02d" $i) - if [ -e "$OSPATH/config/$j" ] - then - sudo ln -s $OSPATH/config/$j/opensim-monit.conf /etc/monit/conf.d/$j.conf - fi -done diff --git a/scripts/group_migrate.sql b/scripts/group_migrate.sql deleted file mode 100644 index 6c15011..0000000 --- a/scripts/group_migrate.sql +++ /dev/null @@ -1,48 +0,0 @@ -INSERT INTO `griddy`.`os_groups_groups` -(GroupID, Name, Charter, InsigniaID, FounderID, MembershipFee, OpenEnrollment, ShowInList, -AllowPublish, MaturePublish, OwnerRoleID) -SELECT GroupID, Name, Charter, InsigniaID, FounderID, MemberShipFee, OpenEnrollment, ShowInList, AllowPublish, -MaturePublish, OwnerRoleID -FROM `griddy`.osgroup; - -/*fill os_groups_invites in ROBUST database with values from osgroupinvite -or FlotSam osgroupinvite*/ -INSERT INTO `griddy`.`os_groups_invites` -(InviteID, GroupID, RoleID, PrincipalID, TMStamp) -SELECT InviteID, GroupID, RoleID, AgentID, TMStamp -FROM `griddy`.osgroupinvite; - -/*fill os_groups_membership in ROBUST database with values from osgroupmembership -or FlotSam osgroupmembership*/ -INSERT INTO `griddy`.`os_groups_membership` -(GroupID, PrincipalID, SelectedRoleID, Contribution, ListInProfile, AcceptNotices) -SELECT GroupID, AgentID, SelectedRoleID, Contribution, ListInProfile, AcceptNotices -FROM `griddy`.osgroupmembership; - -/*fill os_groups_notices in ROBUST database with values from osgroupnotice -or FlotSam osgroupnotice*/ -INSERT INTO `griddy`.`os_groups_notices` -(GroupID, NoticeID, TMStamp, FromName, Subject, Message) -SELECT GroupID, NoticeID, Timestamp, FromName, Subject, Message -FROM `griddy`.osgroupnotice; - -/*fill os_groups_principals in ROBUST database with values from osagent -or FlotSam osagent*/ -INSERT INTO `griddy`.`os_groups_principals` -(PrincipalID, ActiveGroupID) -SELECT AgentID, ActiveGroupID -FROM `griddy`.osagent; - -/*fill os_groups_rolemembership in ROBUST database with values from osrolemembership -or FlotSam osgrouprolemembership*/ -INSERT INTO `griddy`.os_groups_rolemembership -(GroupID, RoleID, PrincipalID) -SELECT GroupID, RoleID, AgentID -FROM `griddy`.osgrouprolemembership; - -/*fill os_groups_roles in ROBUST database with values from osroles -or FlotSam osrole*/ -INSERT INTO `griddy`.os_groups_roles -(GroupID, RoleID, Name, Description, Title, Powers) -SELECT GroupID, RoleID, Name, Description, Title, Powers -FROM `griddy`.osrole; diff --git a/scripts/install/create_sim.sh b/scripts/install/create_sim.sh new file mode 100755 index 0000000..0681067 --- /dev/null +++ b/scripts/install/create_sim.sh @@ -0,0 +1,96 @@ +#!/bin/bash + +source common.sh +getPrgDir + +NAME=$1 +LOCATION=$2 +URL=$3 +IP=$4 +SIZE=$5 + +OSPATH="/opt/opensim" +cd $OSPATH/config + +k=0 +for i in $(seq -w 1 99) +do + j=$(num2name "$i") + if [ -e "$j" ] + then + k=$i + fi +done + +if [ "x$NAME" = "x" ] +then + NAME="No name sim $RANDOM" # Should be unique per grid. + echo "WARNING setting the sim name to [$NAME], this may not be what you want." +fi +# Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows. +sim=$(sanitize $NAME) + +if [ "x$LOCATION" = "x" ] +then + LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case! + echo "WARNING setting the Location to $LOCATION, this may not be what you want." +fi + +if [ "x$IP" = "x" ] +then + # 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP. + IP="0.0.0.0" + echo "WARNING setting the InternalAddress to $IP, this may not be what you want." +# echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." +# According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. +fi + +if [ "x$URL" = "x" ] +then +# Here we make use of an external IP finding service. Careful, it may move. +# URL=$(wget -q http://automation.whatismyip.com/n09230945.asp -O -) # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too. + URL="SYSTEMIP" + echo "WARNING setting the ExternalHostName to $URL, this may not be what you want." +fi + +if [ "x$SIZE" = "x" ] +then + SIZE="256" +fi + +# Wow, the hoops we have to jump through to avoid octal. +if [ 9 -gt $k ]; then + NUM=$(printf '0%1s' $(( 10#$k + 1 )) ) +else + NUM=$(printf '%2s' $(( 10#$k + 1 )) ) +fi + +PORT=$(( 9005 + (10#$k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. +UUID=$(uuidgen) + +echo "Creating sim$NUM on port $PORT @ $LOCATION - $NAME." + +cp -r sim_skeleton sim$NUM + +cd sim$NUM +mv My_sim.xml ${sim}.xml +sed -i "s@SIM_NAME@$NAME@g" ${sim}.xml +sed -i "s@SIM_UUID@$UUID@g" ${sim}.xml +sed -i "s@SIM_POS@$LOCATION@g" ${sim}.xml +sed -i "s@SIM_IP@$IP@g" ${sim}.xml +sed -i "s@SIM_INT_PORT@$(( $PORT + 1 ))@g" ${sim}.xml +sed -i "s@SIM_URL@$URL@g" ${sim}.xml +sed -i "s@SIM_SIZE@$SIZE@g" ${sim}.xml + +ln -s ../../current/scripts/common.sh common.sh +ln -s ../../current/scripts/start-sim start-sim +cp -P start-sim backup-sim +cp -P start-sim stop-sim + +sed -i "s@SIM_NUMBER@$NUM@g" ThisSim.ini +sed -i "s@SIM_PORT@$PORT@g" ThisSim.ini + +sed -i "s@SIM_NUMBER@$NUM@g" opensim-monit.conf + +sudo chown -R opensim:opensim .. +sudo chmod -R g+w .. diff --git a/scripts/install/go_live.sh b/scripts/install/go_live.sh new file mode 100755 index 0000000..21d7072 --- /dev/null +++ b/scripts/install/go_live.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +OSPATH="/opt/opensim" + +for i in $(seq 99) +do + j=$(printf "sim%02d" $i) + if [ -e "$OSPATH/config/$j" ] + then + sudo ln -s $OSPATH/config/$j/opensim-monit.conf /etc/monit/conf.d/$j.conf + fi +done diff --git a/scripts/install/group_migrate.sql b/scripts/install/group_migrate.sql new file mode 100644 index 0000000..6c15011 --- /dev/null +++ b/scripts/install/group_migrate.sql @@ -0,0 +1,48 @@ +INSERT INTO `griddy`.`os_groups_groups` +(GroupID, Name, Charter, InsigniaID, FounderID, MembershipFee, OpenEnrollment, ShowInList, +AllowPublish, MaturePublish, OwnerRoleID) +SELECT GroupID, Name, Charter, InsigniaID, FounderID, MemberShipFee, OpenEnrollment, ShowInList, AllowPublish, +MaturePublish, OwnerRoleID +FROM `griddy`.osgroup; + +/*fill os_groups_invites in ROBUST database with values from osgroupinvite +or FlotSam osgroupinvite*/ +INSERT INTO `griddy`.`os_groups_invites` +(InviteID, GroupID, RoleID, PrincipalID, TMStamp) +SELECT InviteID, GroupID, RoleID, AgentID, TMStamp +FROM `griddy`.osgroupinvite; + +/*fill os_groups_membership in ROBUST database with values from osgroupmembership +or FlotSam osgroupmembership*/ +INSERT INTO `griddy`.`os_groups_membership` +(GroupID, PrincipalID, SelectedRoleID, Contribution, ListInProfile, AcceptNotices) +SELECT GroupID, AgentID, SelectedRoleID, Contribution, ListInProfile, AcceptNotices +FROM `griddy`.osgroupmembership; + +/*fill os_groups_notices in ROBUST database with values from osgroupnotice +or FlotSam osgroupnotice*/ +INSERT INTO `griddy`.`os_groups_notices` +(GroupID, NoticeID, TMStamp, FromName, Subject, Message) +SELECT GroupID, NoticeID, Timestamp, FromName, Subject, Message +FROM `griddy`.osgroupnotice; + +/*fill os_groups_principals in ROBUST database with values from osagent +or FlotSam osagent*/ +INSERT INTO `griddy`.`os_groups_principals` +(PrincipalID, ActiveGroupID) +SELECT AgentID, ActiveGroupID +FROM `griddy`.osagent; + +/*fill os_groups_rolemembership in ROBUST database with values from osrolemembership +or FlotSam osgrouprolemembership*/ +INSERT INTO `griddy`.os_groups_rolemembership +(GroupID, RoleID, PrincipalID) +SELECT GroupID, RoleID, AgentID +FROM `griddy`.osgrouprolemembership; + +/*fill os_groups_roles in ROBUST database with values from osroles +or FlotSam osrole*/ +INSERT INTO `griddy`.os_groups_roles +(GroupID, RoleID, Name, Description, Title, Powers) +SELECT GroupID, RoleID, Name, Description, Title, Powers +FROM `griddy`.osrole; diff --git a/scripts/install/opensim-monit.conf b/scripts/install/opensim-monit.conf new file mode 100644 index 0000000..7785056 --- /dev/null +++ b/scripts/install/opensim-monit.conf @@ -0,0 +1,36 @@ +# manage the OpenSim process for Your Sim +# +# usage: +# monit start your_sim +# monit stop your_sim +# monit restart your_sim +# +# see 'daemon' setting in /etc/monit/monitrc for the cycle length. +# on ubuntu/debian, this is overridden by the CHECK_INTERVALS var in +# /etc/default/monit . the below assumes you've set it to 30 seconds. +# +# if process dies, will restart sim within 30 seconds. if process +# dies 5 times in as many tries, will stop trying and send email +# alert. +# +# if SimFPS drops to 0 for 2 minutes, restart. +# +# if process CPU usage stays above 300% for 2 minutes, restart. +# +# see ../README for configuration instructions. +# +# Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. +# +check process sim01 with pidfile /var/run/opensim/sim01.pid + start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/sim01 && /opt/opensim/config/sim01/start-sim -q'" + as uid root and gid root + stop program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/sim01 && /opt/opensim/config/sim01/stop-sim'" with timeout 600 seconds + if cpu usage > 50% for 4 cycles then restart +# if 5 restarts within 5 cycles then timeout +# if failed url http://127.0.0.1:9005/jsonSimStats/ +# and content != '"SimFPS":0.0,' for 4 cycles +# then restart +# if failed url http://127.0.0.1:9008/jsonSimStats/ +# and content == '"SimFPS":' for 4 cycles +# then restart + diff --git a/scripts/install/opensim.tmux.conf b/scripts/install/opensim.tmux.conf new file mode 100644 index 0000000..ea342a2 --- /dev/null +++ b/scripts/install/opensim.tmux.conf @@ -0,0 +1,52 @@ +# Tmux has a habit of changing what these options are for each version, so this is a bit of a mess. + +set-option -g prefix C-a +unbind-key C-b +bind-key C-a send-prefix + +# r reloads the configuration, handy +bind r source-file ~/.tmux.conf + +unbind % # Remove default binding since we’re replacing them. +bind | split-window -h +bind - split-window -v + +set-option -g bell-action any +set-option -g bell-on-alert on + +set-option -g history-limit 100000 + +# These three wont work under Ubuntu 16.04. +set-option -g mouse-resize-pane on +set-option -g mouse-select-pane on +set-option -g mouse-select-window on +set-option -g mouse-utf8 on + +#set-option -g set-remain-on-exit on +set-option -g set-titles on +set-option -g set-titles-string '#W' + +set-option -g status-interval 1 +set-option -g status-justify centre +set-option -g status-utf8 on + +set-option -g status-left-length 80 +set-option -g status-left '[#H #S #F]' +set-option -g status-right-length 80 +set-option -g status-right '%F #(uptime)'<-----># &F is ISO date, uptime starts with the current time, and ends with the load average. B-) + +set-option -g visual-activity on +set-option -g visual-content on +set-option -g visual-silence on + +set-option -gw clock-mode-style 24 +# This wont work under Ubuntu 16.04. +set-option -gw mode-mouse on +# Instead do this (also defaults to turning on the above three mouse things) - +#set-option -gw mouse on + +# Highlight active window +set-option -gw window-status-current-bg red + +# Set window notifications +set-option -gw monitor-activity on diff --git a/scripts/opensim-monit.conf b/scripts/opensim-monit.conf deleted file mode 100644 index 7785056..0000000 --- a/scripts/opensim-monit.conf +++ /dev/null @@ -1,36 +0,0 @@ -# manage the OpenSim process for Your Sim -# -# usage: -# monit start your_sim -# monit stop your_sim -# monit restart your_sim -# -# see 'daemon' setting in /etc/monit/monitrc for the cycle length. -# on ubuntu/debian, this is overridden by the CHECK_INTERVALS var in -# /etc/default/monit . the below assumes you've set it to 30 seconds. -# -# if process dies, will restart sim within 30 seconds. if process -# dies 5 times in as many tries, will stop trying and send email -# alert. -# -# if SimFPS drops to 0 for 2 minutes, restart. -# -# if process CPU usage stays above 300% for 2 minutes, restart. -# -# see ../README for configuration instructions. -# -# Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. -# -check process sim01 with pidfile /var/run/opensim/sim01.pid - start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/sim01 && /opt/opensim/config/sim01/start-sim -q'" - as uid root and gid root - stop program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/sim01 && /opt/opensim/config/sim01/stop-sim'" with timeout 600 seconds - if cpu usage > 50% for 4 cycles then restart -# if 5 restarts within 5 cycles then timeout -# if failed url http://127.0.0.1:9005/jsonSimStats/ -# and content != '"SimFPS":0.0,' for 4 cycles -# then restart -# if failed url http://127.0.0.1:9008/jsonSimStats/ -# and content == '"SimFPS":' for 4 cycles -# then restart - diff --git a/scripts/opensim.tmux.conf b/scripts/opensim.tmux.conf deleted file mode 100644 index ea342a2..0000000 --- a/scripts/opensim.tmux.conf +++ /dev/null @@ -1,52 +0,0 @@ -# Tmux has a habit of changing what these options are for each version, so this is a bit of a mess. - -set-option -g prefix C-a -unbind-key C-b -bind-key C-a send-prefix - -# r reloads the configuration, handy -bind r source-file ~/.tmux.conf - -unbind % # Remove default binding since we’re replacing them. -bind | split-window -h -bind - split-window -v - -set-option -g bell-action any -set-option -g bell-on-alert on - -set-option -g history-limit 100000 - -# These three wont work under Ubuntu 16.04. -set-option -g mouse-resize-pane on -set-option -g mouse-select-pane on -set-option -g mouse-select-window on -set-option -g mouse-utf8 on - -#set-option -g set-remain-on-exit on -set-option -g set-titles on -set-option -g set-titles-string '#W' - -set-option -g status-interval 1 -set-option -g status-justify centre -set-option -g status-utf8 on - -set-option -g status-left-length 80 -set-option -g status-left '[#H #S #F]' -set-option -g status-right-length 80 -set-option -g status-right '%F #(uptime)'<-----># &F is ISO date, uptime starts with the current time, and ends with the load average. B-) - -set-option -g visual-activity on -set-option -g visual-content on -set-option -g visual-silence on - -set-option -gw clock-mode-style 24 -# This wont work under Ubuntu 16.04. -set-option -gw mode-mouse on -# Instead do this (also defaults to turning on the above three mouse things) - -#set-option -gw mouse on - -# Highlight active window -set-option -gw window-status-current-bg red - -# Set window notifications -set-option -gw monitor-activity on -- cgit v1.1 From ca7a2ed839f8fec5a7d7abbf50fc2c031f192fb5 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 22 May 2019 19:14:35 +1000 Subject: Major tweaking of the scripts to suit the new setup. --- scripts/backup-sims.sh | 4 +-- scripts/common.sh | 3 ++- scripts/install/create_sim.sh | 55 +++++++++++++++++++------------------- scripts/install/go_live.sh | 2 +- scripts/install/opensim-monit.conf | 17 ++++-------- scripts/install/secure.sh | 20 ++++++++++++++ scripts/start-sim | 18 ++++++------- 7 files changed, 66 insertions(+), 53 deletions(-) create mode 100755 scripts/install/secure.sh (limited to 'scripts') diff --git a/scripts/backup-sims.sh b/scripts/backup-sims.sh index b14acca..cadb9a2 100755 --- a/scripts/backup-sims.sh +++ b/scripts/backup-sims.sh @@ -6,9 +6,9 @@ getPrgDir for i in $(seq -w 1 99) do j=$(num2name ${i}) - if [ -e "${PRGDIR}/../config/${j}" ] + if [ -e "${PRGDIR}/../../config/${j}" ] then - pushd ${PRGDIR}/../config/${j} >/dev/null + pushd ${PRGDIR}/../../config/${j} >/dev/null # Find out the size of the last backup, base our later sleep on that, but do it now before backup-sim packs it away. sizeSleep=`sleepPerSize o "$(getSimName ${i})"` ./backup-sim diff --git a/scripts/common.sh b/scripts/common.sh index 2ec19ce..c5a86ab 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -1,5 +1,7 @@ #!/bin/echo Don't run this file, it's for common functions." +OS_PATH="/opt/opensim_SC" +OS_USER="opensimsc" # Figure out where we are, most of this mess is to troll through soft links. # PRGDIR=$(getPrgDir) @@ -73,4 +75,3 @@ sleepPerSize() echo 200 fi } - diff --git a/scripts/install/create_sim.sh b/scripts/install/create_sim.sh index 0681067..08cedba 100755 --- a/scripts/install/create_sim.sh +++ b/scripts/install/create_sim.sh @@ -1,6 +1,6 @@ #!/bin/bash -source common.sh +source ../common.sh getPrgDir NAME=$1 @@ -9,8 +9,7 @@ URL=$3 IP=$4 SIZE=$5 -OSPATH="/opt/opensim" -cd $OSPATH/config +cd ${OS_PATH}/config k=0 for i in $(seq -w 1 99) @@ -22,38 +21,37 @@ do fi done -if [ "x$NAME" = "x" ] +if [ "x${NAME}" = "x" ] then NAME="No name sim $RANDOM" # Should be unique per grid. - echo "WARNING setting the sim name to [$NAME], this may not be what you want." + echo "WARNING setting the sim name to [${NAME}], this may not be what you want." fi # Sanitize the name. Not removing [ or ], couldn't get that to work, only important for Windows. -sim=$(sanitize $NAME) +sim=$(sanitize ${NAME}) -if [ "x$LOCATION" = "x" ] +if [ "x${LOCATION}" = "x" ] then LOCATION="$RANDOM,$RANDOM" # again UNIQUE (i.e. ONLY ONE) per grid in THIS case! - echo "WARNING setting the Location to $LOCATION, this may not be what you want." + echo "WARNING setting the Location to ${LOCATION}, this may not be what you want." fi -if [ "x$IP" = "x" ] +if [ "x${IP}" = "x" ] then - # 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP. IP="0.0.0.0" - echo "WARNING setting the InternalAddress to $IP, this may not be what you want." + echo "WARNING setting the InternalAddress to ${IP}, this may not be what you want." # echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." # According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. fi -if [ "x$URL" = "x" ] +if [ "x${URL}" = "x" ] then # Here we make use of an external IP finding service. Careful, it may move. # URL=$(wget -q http://automation.whatismyip.com/n09230945.asp -O -) # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too. URL="SYSTEMIP" - echo "WARNING setting the ExternalHostName to $URL, this may not be what you want." + echo "WARNING setting the ExternalHostName to ${URL}, this may not be what you want." fi -if [ "x$SIZE" = "x" ] +if [ "x${SIZE}" = "x" ] then SIZE="256" fi @@ -68,29 +66,30 @@ fi PORT=$(( 9005 + (10#$k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. UUID=$(uuidgen) -echo "Creating sim$NUM on port $PORT @ $LOCATION - $NAME." +echo "Creating sim${NUM} on port ${PORT} @ ${LOCATION} - ${NAME}." -cp -r sim_skeleton sim$NUM +cp -r sim_skeleton sim${NUM} -cd sim$NUM +cd sim${NUM} mv My_sim.xml ${sim}.xml -sed -i "s@SIM_NAME@$NAME@g" ${sim}.xml -sed -i "s@SIM_UUID@$UUID@g" ${sim}.xml -sed -i "s@SIM_POS@$LOCATION@g" ${sim}.xml -sed -i "s@SIM_IP@$IP@g" ${sim}.xml -sed -i "s@SIM_INT_PORT@$(( $PORT + 1 ))@g" ${sim}.xml -sed -i "s@SIM_URL@$URL@g" ${sim}.xml -sed -i "s@SIM_SIZE@$SIZE@g" ${sim}.xml +sed -i "s@SIM_NAME@${NAME}@g" ${sim}.xml +sed -i "s@SIM_UUID@${UUID}@g" ${sim}.xml +sed -i "s@SIM_POS@${LOCATION}@g" ${sim}.xml +sed -i "s@SIM_IP@${IP}@g" ${sim}.xml +sed -i "s@SIM_INT_PORT@$(( ${PORT} + 1 ))@g" ${sim}.xml +sed -i "s@SIM_URL@${URL}@g" ${sim}.xml +sed -i "s@SIM_SIZE@${SIZE}@g" ${sim}.xml ln -s ../../current/scripts/common.sh common.sh ln -s ../../current/scripts/start-sim start-sim cp -P start-sim backup-sim cp -P start-sim stop-sim -sed -i "s@SIM_NUMBER@$NUM@g" ThisSim.ini -sed -i "s@SIM_PORT@$PORT@g" ThisSim.ini +sed -i "s@SIM_NUMBER@${NUM}@g" ThisSim.ini +sed -i "s@SIM_PORT@${PORT}@g" ThisSim.ini -sed -i "s@SIM_NUMBER@$NUM@g" opensim-monit.conf +sed -i "s@OS_PATH@${OS_PATH}@g" opensim-monit.conf +sed -i "s@SIM_NUMBER@${NUM}@g" opensim-monit.conf -sudo chown -R opensim:opensim .. +sudo chown -R ${OS_USER}:${OS_USER} .. sudo chmod -R g+w .. diff --git a/scripts/install/go_live.sh b/scripts/install/go_live.sh index 21d7072..c5ce90e 100755 --- a/scripts/install/go_live.sh +++ b/scripts/install/go_live.sh @@ -1,6 +1,6 @@ #!/bin/bash -OSPATH="/opt/opensim" +source common.sh for i in $(seq 99) do diff --git a/scripts/install/opensim-monit.conf b/scripts/install/opensim-monit.conf index 7785056..409b69e 100644 --- a/scripts/install/opensim-monit.conf +++ b/scripts/install/opensim-monit.conf @@ -9,23 +9,16 @@ # on ubuntu/debian, this is overridden by the CHECK_INTERVALS var in # /etc/default/monit . the below assumes you've set it to 30 seconds. # -# if process dies, will restart sim within 30 seconds. if process -# dies 5 times in as many tries, will stop trying and send email -# alert. -# -# if SimFPS drops to 0 for 2 minutes, restart. -# -# if process CPU usage stays above 300% for 2 minutes, restart. -# # see ../README for configuration instructions. # # Hmmmm, seems that monit changing to a user and running bash -l is different from sudo changing to a user and running bash -l. # -check process sim01 with pidfile /var/run/opensim/sim01.pid - start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/sim01 && /opt/opensim/config/sim01/start-sim -q'" +check process simSIM_NUMBER with pidfile /OS_PATH/caches/simSIM_NUMBER.pid + start program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /OS_PATH/config/simSIM_NUMBER && /OS_PATH/config/simSIM_NUMBER/start-sim -q'" as uid root and gid root - stop program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /opt/opensim/config/sim01 && /opt/opensim/config/sim01/stop-sim'" with timeout 600 seconds + stop program = "/usr/bin/sudo -Hu opensim /bin/bash -lc 'cd /OS_PATH/config/simSIM_NUMBER && /OS_PATH/config/simSIM_NUMBER/stop-sim'" with timeout 600 seconds if cpu usage > 50% for 4 cycles then restart + if MEMORY usage > 10% for 4 cycles then restart # if 5 restarts within 5 cycles then timeout # if failed url http://127.0.0.1:9005/jsonSimStats/ # and content != '"SimFPS":0.0,' for 4 cycles @@ -33,4 +26,4 @@ check process sim01 with pidfile /var/run/opensim/sim01.pid # if failed url http://127.0.0.1:9008/jsonSimStats/ # and content == '"SimFPS":' for 4 cycles # then restart - + depends on ROBUST diff --git a/scripts/install/secure.sh b/scripts/install/secure.sh new file mode 100755 index 0000000..48255b6 --- /dev/null +++ b/scripts/install/secure.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +source ../common.sh + +echo "Securing OpenSim." +sudo chmod 600 ${OS_PATH}/config/*.ini +sudo chown -R ${OS_USER}:${OS_USER} ${OS_PATH} +sudo chmod -R 775 ${OS_PATH} +sudo chmod -R a-x ${OS_PATH} +sudo chmod -R a+X ${OS_PATH} +sudo chmod -R g+w ${OS_PATH} +sudo chmod -R a+x ${OS_PATH}/current/*.sh +sudo chmod -R a+x ${OS_PATH}/current/scripts/*.sh +sudo chmod -R a+x ${OS_PATH}/current/scripts/install/*.sh +sudo chmod a+x ${OS_PATH}/current/scripts/show-console +sudo chmod a+x ${OS_PATH}/current/scripts/start-sim + +sudo chmod ug+rwx ${OS_PATH}/config +sudo chmod g+s ${OS_PATH}/config +sudo chmod 600 ${OS_PATH}/config/*.ini diff --git a/scripts/start-sim b/scripts/start-sim index bd0815f..e82547a 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -38,11 +38,11 @@ fi if [ "x$1" = "x" ]; then tgt=$(basename $(pwd)) num="$(echo ${tgt} | cut -c 4-)" -elif [ -d "./$1" ]; then +elif [ -d "$1" ]; then tgt=$1 -elif [ -d "./sim$1" ]; then +elif [ -d "sim$1" ]; then num=$1 - tgt="./sim${num}" + tgt="sim${num}" else tgt=$1 inventory=$1 @@ -77,14 +77,14 @@ fi case $(basename $0) in "start-sim") - cmd="mono ${exe}.exe -inidirectory=${tgt} " + cmd="mono ${exe}.exe -inidirectory=../../config/${tgt} " # Check if it's already running. if [ -e /var/run/opensim/${tgt}.pid ] then # Double check if it's REALLY running. - if [ "x$(ps -p $(cat /var/run/opensim/${tgt}.pid) --no-headers -o comm)" = "x" ]; then - $SUDO rm -f /var/run/opensim/${tgt}.pid + if [ "x$(ps -p $(cat ${PRGDIR}/../../caches/${tgt}.pid) --no-headers -o comm)" = "x" ]; then + $SUDO rm -f ${PRGDIR}/../../caches/${tgt}.pid fi fi # Now see if it's really really running. lol @@ -92,9 +92,9 @@ case $(basename $0) in then if [ "x$tgt" = "xROBUST" ]; then # TODO - the problem here is that the > bit is executed as onefang, not as opensim. - $SUDO cat ../config/config.ini ../config/Robust.ini.template >../config/Robust.ini -# $SUDO chown -R opensim:opensim ../config/Robust.ini - chmod 640 ../config/Robust.ini + $SUDO cat ${PRGDIR}/../../config/config.ini ${PRGDIR}/../../config/Robust.ini.template >${PRGDIR}/../../config/Robust.ini +# $SUDO chown -R opensim:opensim ${PRGDIR}/../../config/Robust.ini + chmod 640 ${PRGDIR}/../../config/Robust.ini ${tmux_command} split-window -hp 50 -t "${tmux_session}:" "${cmd}" else ${tmux_command} new-window -dn "${title}" -t "${tmux_session}:${num}" "${cmd}" -- cgit v1.1 From 46c9f672a4a8f5de090d291e8359b3c7d6502370 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 23 May 2019 21:49:29 +1000 Subject: Update the tmux config. I do wish they would stop changing config options. --- scripts/install/opensim.tmux.conf | 85 ++++++++++++++++++++++++++++++--------- 1 file changed, 65 insertions(+), 20 deletions(-) (limited to 'scripts') diff --git a/scripts/install/opensim.tmux.conf b/scripts/install/opensim.tmux.conf index ea342a2..a5088aa 100644 --- a/scripts/install/opensim.tmux.conf +++ b/scripts/install/opensim.tmux.conf @@ -1,5 +1,6 @@ # Tmux has a habit of changing what these options are for each version, so this is a bit of a mess. +# Screen compatibility, change the command key. And rebind the prefix sending command. set-option -g prefix C-a unbind-key C-b bind-key C-a send-prefix @@ -7,46 +8,90 @@ bind-key C-a send-prefix # r reloads the configuration, handy bind r source-file ~/.tmux.conf -unbind % # Remove default binding since we’re replacing them. +bind R clear-history + +# More sane pane gain. B-) +unbind % # Remove default binding since we’re replacing them. +unbind '"' bind | split-window -h bind - split-window -v +# set-options -g global, -s server, -w window, otherwise a session option. +# -a appends a string to the existing option. +# -u unsets an option. +# -o prevents setting an aption if it is already set. +# -q shut up info messages. + +# SESSION OPTIONS + set-option -g bell-action any set-option -g bell-on-alert on +# Not actually documented what the limit is, but there is one. set-option -g history-limit 100000 +# All this mouse stuff is unreliable in UTF8 mode. At least on roxterm. +# Also keep in mind the terminal specs mouse report limit of 256 characters, being less than my typical terminal width. +# Hmm, still wont pass mouse through like the docs say they will. +# Ah, mc needs "mc -x". Though once again, watch that right edge on huge terminals. # These three wont work under Ubuntu 16.04. -set-option -g mouse-resize-pane on -set-option -g mouse-select-pane on -set-option -g mouse-select-window on -set-option -g mouse-utf8 on +##set-option -g mouse-resize-pane on +##set-option -g mouse-select-pane on +##set-option -g mouse-select-window on +# This wont work under Ubuntu 16.04. +##set-option -g mode-mouse on # on - mouse does copy mode stuff; copy-mode - mouse can't go into copy mode, but does stuff once in there; off - mouse is unmolested. +# Instead do this (also defaults to turning on the above three mouse things) - +set-option -g mouse on +# Or this. sigh +#set-option -g mouse +##set-option -g mouse-utf8 off # Defaults to on. + +set-option -g set-remain-on-exit on -#set-option -g set-remain-on-exit on +# How to set the title of the terminal window. set-option -g set-titles on -set-option -g set-titles-string '#W' +set-option -g set-titles-string '#W' # Default is "#S:#I:#W - "#T"" -set-option -g status-interval 1 -set-option -g status-justify centre -set-option -g status-utf8 on +set-option -g status-interval 1 # Redraw status line every second, for the clock. +set-option -g status-justify centre # Window list in the middle. +##set-option -g status-utf8 on +# Character pair Replaced with + #(shell-command) First line of the command's output + #[attributes] Colour or attribute change + #H Hostname of local host (not FDQN) + #h Hostname of local host without the domain name + #F Current window flag + #I Current window index + #D Current pane unique identifier + #P Current pane index + #S Session name + #T Current pane title + #W Current window name + ## A literal ‘#’ + +# Yes, my terminal really is bigger than 160 characters. set-option -g status-left-length 80 -set-option -g status-left '[#H #S #F]' +#set-option -g status-left '[#H #S #F]' +set-option -g status-left '#H [#S:#I.#P]#F' set-option -g status-right-length 80 set-option -g status-right '%F #(uptime)'<-----># &F is ISO date, uptime starts with the current time, and ends with the load average. B-) -set-option -g visual-activity on -set-option -g visual-content on -set-option -g visual-silence on +# Set window notifications +set-option -g visual-activity on # Show status message for activity in monitor-activity windows. +#set-option -g visual-content on # Show status message for content in monitor-content windows. Based on a fnmatch(3) string. +set-option -g visual-silence on # Show status message for silence in monitor-silence windows. Based on a set interval. -set-option -gw clock-mode-style 24 -# This wont work under Ubuntu 16.04. -set-option -gw mode-mouse on -# Instead do this (also defaults to turning on the above three mouse things) - -#set-option -gw mouse on +set-option -gw alternate-screen off # Don't save the original screen before starting tmux, may also allow use of the terminals original scrollback buffer. +set-option -gw clock-mode-style 24 # We are using the uptime clock anyway, so this is pointless. # Highlight active window set-option -gw window-status-current-bg red +set-option -gw window-status-current-format '[#I:#W]' +set-option -gw window-status-format '[#I:#W]#F' # Set window notifications -set-option -gw monitor-activity on +set-option -gw monitor-activity on # Bell on activity. + +# We want 256 colours in our terminal. +set-option -g default-terminal "screen-256color" -- cgit v1.1 From 53baef9042cb30d29a66933da105029101b455d3 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 23 May 2019 21:50:45 +1000 Subject: Management scripts encounters the real world, needs patching up. --- scripts/install/secure.sh | 4 ++++ scripts/show-console | 2 +- scripts/start-sim | 24 ++++++++++++------------ 3 files changed, 17 insertions(+), 13 deletions(-) (limited to 'scripts') 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 sudo chmod ug+rwx ${OS_PATH}/config sudo chmod g+s ${OS_PATH}/config sudo chmod 600 ${OS_PATH}/config/*.ini + +chmod ug+rwx ${OS_PATH}/caches +chmod o-rwx ${OS_PATH}/caches +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 @@ #!/bin/bash -tmux -S /var/run/opensim/opensim-tmux.socket select-window -t "OpenSim_console" \; attach-session -t "OpenSim_console" +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 getPrgDir USER=$(whoami) -console_name="OpenSim_console" -tmux_command="tmux -S /var/run/opensim/opensim-tmux.socket" +console_name="OpenSimSC_console" +tmux_command="tmux -S ${PRGDIR}/../../caches/opensim-tmux.socket" tmux_session=${console_name} tmux_window="${tmux_command} select-window -t ${tmux_session}" tmux_send="${tmux_command} send-keys -t ${tmux_session}" @@ -22,11 +22,11 @@ function wait_for_text() done } -if [ $USER = "opensim" ] +if [ $USER = "${OS_USER}" ] then SUDO="" else - SUDO="sudo -Hu opensim" + SUDO="sudo -Hu ${OS_USER}" fi if [ "$1" = "-q" ] @@ -80,7 +80,7 @@ case $(basename $0) in cmd="mono ${exe}.exe -inidirectory=../../config/${tgt} " # Check if it's already running. - if [ -e /var/run/opensim/${tgt}.pid ] + if [ -e ${PRGDIR}/../../caches/${tgt}.pid ] then # Double check if it's REALLY running. if [ "x$(ps -p $(cat ${PRGDIR}/../../caches/${tgt}.pid) --no-headers -o comm)" = "x" ]; then @@ -88,12 +88,12 @@ case $(basename $0) in fi fi # Now see if it's really really running. lol - if [ ! -e /var/run/opensim/${tgt}.pid ] + if [ ! -e ${PRGDIR}/../../caches/${tgt}.pid ] then if [ "x$tgt" = "xROBUST" ]; then -# TODO - the problem here is that the > bit is executed as onefang, not as opensim. +# TODO - the problem here is that the > bit is executed as the user, not as opensim. $SUDO cat ${PRGDIR}/../../config/config.ini ${PRGDIR}/../../config/Robust.ini.template >${PRGDIR}/../../config/Robust.ini -# $SUDO chown -R opensim:opensim ${PRGDIR}/../../config/Robust.ini +# $SUDO chown -R ${OS_USER}:${OS_USER} ${PRGDIR}/../../config/Robust.ini chmod 640 ${PRGDIR}/../../config/Robust.ini ${tmux_command} split-window -hp 50 -t "${tmux_session}:" "${cmd}" else @@ -124,7 +124,7 @@ case $(basename $0) in ;; "backup-sim") - if [ -e /var/run/opensim/${tgt}.pid ]; then + if [ -e ${PRGDIR}/../../caches/${tgt}.pid ]; then cd ${PRGDIR} $SUDO ${PRGDIR}/gitAR.sh o "${title}" sim=$(sanitize "${title}") @@ -141,7 +141,7 @@ case $(basename $0) in ;; "stop-sim") - if [ -e /var/run/opensim/${tgt}.pid ]; then + if [ -e ${PRGDIR}/../../caches/${tgt}.pid ]; then ${tmux_send}:"${title}" "alert WARNING - Emergency shutdown in one minute!" Enter ${tmux_send}:"${title}" "alert WARNING - Emergency shutdown in one minute!" Enter sleep 30 @@ -150,9 +150,9 @@ case $(basename $0) in sleep 30 ${tmux_send}:"${title}" "shutdown" Enter sleep 30 - if [ -e /var/run/opensim/${tgt}.pid ]; then + if [ -e ${PRGDIR}/../../caches/${tgt}.pid ]; then echo "Killing it with extreme prejudice!" - kill -TERM `cat /var/run/opensim/${tgt}.pid` + kill -TERM `cat ${PRGDIR}/../../caches/${tgt}.pid` fi else echo "Sim ${title} is not running, so not stopping." -- cgit v1.1 From f921cb712e67893b44496192e5297335ed65caf7 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 28 May 2019 06:19:38 +1000 Subject: Add [Region] .ini block. For including actual region definition in the normal .ini stack. Same as the usual Region.ini format, except we add a RegionName parameter. --- scripts/common.sh | 4 ++-- scripts/install/create_sim.sh | 15 +++++++-------- scripts/start-sim | 2 +- 3 files changed, 10 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/common.sh b/scripts/common.sh index c5a86ab..9d985f2 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -42,11 +42,11 @@ sanitize() } -# Grab the first Section line of the sims .xml file, cut it down to the name. +# Grab the first Section line of the sims .ini file, cut it down to the name. # name=$(getSimName 1) getSimName() { - grep "
bit is executed as the user, not as opensim. +cat ${PRGDIR}/../../config/config.ini ${PRGDIR}/../bin/Robust.ini >${PRGDIR}/../../config/Robust.ini +chown -R ${OS_USER}:${OS_USER} ${PRGDIR}/../../config/Robust.ini +chmod 600 ${PRGDIR}/../../config/Robust.ini diff --git a/scripts/start-sim b/scripts/start-sim index 4bcc803..1414826 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -22,6 +22,7 @@ function wait_for_text() done } + if [ $USER = "${OS_USER}" ] then SUDO="" @@ -91,10 +92,10 @@ case $(basename $0) in if [ ! -e ${PRGDIR}/../../caches/${tgt}.pid ] then if [ "x$tgt" = "xROBUST" ]; then -# TODO - the problem here is that the > bit is executed as the user, not as opensim. - $SUDO cat ${PRGDIR}/../../config/config.ini ${PRGDIR}/../../config/Robust.ini.template >${PRGDIR}/../../config/Robust.ini -# $SUDO chown -R ${OS_USER}:${OS_USER} ${PRGDIR}/../../config/Robust.ini - chmod 640 ${PRGDIR}/../../config/Robust.ini + pushd ${PRGDIR}/../scripts + $SUDO ./robust-include + popd + cmd="${cmd} -inifile=${PRGDIR}/../../config/Robust.ini" ${tmux_command} split-window -hp 50 -t "${tmux_session}:" "${cmd}" else ${tmux_command} new-window -dn "${title}" -t "${tmux_session}:${num}" "${cmd}" -- cgit v1.1 From 451e158895a5ea5e1064ba28ff35b0b93105ede7 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 24 Jul 2019 17:26:44 +1000 Subject: Make the installation more robust. --- scripts/install/secure.sh | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts') diff --git a/scripts/install/secure.sh b/scripts/install/secure.sh index 43ed679..db73558 100755 --- a/scripts/install/secure.sh +++ b/scripts/install/secure.sh @@ -12,6 +12,7 @@ sudo chmod -R g+w ${OS_PATH} sudo chmod -R a+x ${OS_PATH}/current/*.sh sudo chmod -R a+x ${OS_PATH}/current/scripts/*.sh sudo chmod -R a+x ${OS_PATH}/current/scripts/install/*.sh +sudo chmod a+x ${OS_PATH}/current/scripts/robust-include sudo chmod a+x ${OS_PATH}/current/scripts/show-console sudo chmod a+x ${OS_PATH}/current/scripts/start-sim -- cgit v1.1 From 97b4356064f367337863fae0f8423dd33db74fdc Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 28 Jul 2019 22:57:58 +1000 Subject: Forgot to update a script comment. --- scripts/start-sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/start-sim b/scripts/start-sim index 1414826..774aa54 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -62,7 +62,7 @@ if ( ${tmux_command} -q list-sessions 2>/dev/null | grep -q ${console_name}: ); true else # The sudo is only so that the session is owned by opensim, otherwise it's owned by whoever ran this script, which is a likely security hole. - # After the session is created, we rely on the /var/run/opensim directory to be group sticky, so that anyone in the opensim group can attach to the tmux socket. + # After the session is created, we rely on the ${PRGDIR}/../../caches/ directory to be group sticky, so that anyone in the opensim group can attach to the tmux socket. $SUDO ${tmux_command} new-session -d -s ${console_name} -n "Server" fi -- cgit v1.1 From dbff9cb5ec4b84a75b3eef1569c0da9c2175784e Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 1 Aug 2019 05:54:22 +1000 Subject: ROBUST does support includes, so use them. --- scripts/install/secure.sh | 1 - scripts/robust-include | 11 ----------- scripts/start-sim | 4 ---- 3 files changed, 16 deletions(-) delete mode 100755 scripts/robust-include (limited to 'scripts') diff --git a/scripts/install/secure.sh b/scripts/install/secure.sh index db73558..43ed679 100755 --- a/scripts/install/secure.sh +++ b/scripts/install/secure.sh @@ -12,7 +12,6 @@ sudo chmod -R g+w ${OS_PATH} sudo chmod -R a+x ${OS_PATH}/current/*.sh sudo chmod -R a+x ${OS_PATH}/current/scripts/*.sh sudo chmod -R a+x ${OS_PATH}/current/scripts/install/*.sh -sudo chmod a+x ${OS_PATH}/current/scripts/robust-include sudo chmod a+x ${OS_PATH}/current/scripts/show-console sudo chmod a+x ${OS_PATH}/current/scripts/start-sim diff --git a/scripts/robust-include b/scripts/robust-include deleted file mode 100755 index e427eb1..0000000 --- a/scripts/robust-include +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -# Silly script to get around the lack of includes in ROBUST. - -source common.sh -getPrgDir - -# The problem here is that the > bit is executed as the user, not as opensim. -cat ${PRGDIR}/../../config/config.ini ${PRGDIR}/../bin/Robust.ini >${PRGDIR}/../../config/Robust.ini -chown -R ${OS_USER}:${OS_USER} ${PRGDIR}/../../config/Robust.ini -chmod 600 ${PRGDIR}/../../config/Robust.ini diff --git a/scripts/start-sim b/scripts/start-sim index 774aa54..3966ac8 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -92,10 +92,6 @@ case $(basename $0) in if [ ! -e ${PRGDIR}/../../caches/${tgt}.pid ] then if [ "x$tgt" = "xROBUST" ]; then - pushd ${PRGDIR}/../scripts - $SUDO ./robust-include - popd - cmd="${cmd} -inifile=${PRGDIR}/../../config/Robust.ini" ${tmux_command} split-window -hp 50 -t "${tmux_session}:" "${cmd}" else ${tmux_command} new-window -dn "${title}" -t "${tmux_session}:${num}" "${cmd}" -- cgit v1.1 From fa4fdac7fc831e55cfc3a8300426f40a796e8104 Mon Sep 17 00:00:00 2001 From: onefang Date: Fri, 2 Aug 2019 14:57:51 +1000 Subject: Bump sim ports up by 2 when creating, coz 5 is silly. --- scripts/install/create_sim.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/install/create_sim.sh b/scripts/install/create_sim.sh index 475c127..16b668a 100755 --- a/scripts/install/create_sim.sh +++ b/scripts/install/create_sim.sh @@ -63,7 +63,7 @@ else NUM=$(printf '%2s' $(( 10#$k + 1 )) ) fi -PORT=$(( 9005 + (10#$k * 5) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. +PORT=$(( 9005 + (10#$k * 2) )) # 9002 is used for HTTP/UDP so START with port 9003! CAUTION Diva/D2 starts at port 9000. UUID=$(uuidgen) echo "Creating sim${NUM} on port ${PORT} @ ${LOCATION} - ${NAME}." -- cgit v1.1 From b6b38dd4206c35dec02edd7bbfd9a0545fc12df6 Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 4 Aug 2019 01:50:56 +1000 Subject: Tweaking create_sim. ExternalHostName = "${Const|HostName}" Move size to the third argument. --- scripts/install/create_sim.sh | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) (limited to 'scripts') diff --git a/scripts/install/create_sim.sh b/scripts/install/create_sim.sh index 16b668a..055f802 100755 --- a/scripts/install/create_sim.sh +++ b/scripts/install/create_sim.sh @@ -5,9 +5,8 @@ getPrgDir NAME=$1 LOCATION=$2 -URL=$3 +SIZE=$3 IP=$4 -SIZE=$5 cd ${OS_PATH}/config @@ -35,6 +34,11 @@ then echo "WARNING setting the Location to ${LOCATION}, this may not be what you want." fi +if [ "x${SIZE}" = "x" ] +then + SIZE="256" +fi + if [ "x${IP}" = "x" ] then IP="0.0.0.0" @@ -43,19 +47,6 @@ then # According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. fi -if [ "x${URL}" = "x" ] -then -# Here we make use of an external IP finding service. Careful, it may move. -# URL=$(wget -q http://automation.whatismyip.com/n09230945.asp -O -) # URL is best (without the HTTP://), but IP (e.g. 88.109.81.55) works too. - URL="SYSTEMIP" - echo "WARNING setting the ExternalHostName to ${URL}, this may not be what you want." -fi - -if [ "x${SIZE}" = "x" ] -then - SIZE="256" -fi - # Wow, the hoops we have to jump through to avoid octal. if [ 9 -gt $k ]; then NUM=$(printf '0%1s' $(( 10#$k + 1 )) ) @@ -76,7 +67,6 @@ sed -i "s@SIM_UUID@${UUID}@g" ThisSim.ini sed -i "s@SIM_POS@${LOCATION}@g" ThisSim.ini sed -i "s@SIM_IP@${IP}@g" ThisSim.ini sed -i "s@SIM_INT_PORT@$(( ${PORT} + 1 ))@g" ThisSim.ini -sed -i "s@SIM_URL@${URL}@g" ThisSim.ini sed -i "s@SIM_SIZE@${SIZE}@g" ThisSim.ini ln -s ../../current/scripts/common.sh common.sh -- cgit v1.1 From ecf4a93a481efb4dc1a2e867440b80a866446d3d Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 4 Aug 2019 01:53:07 +1000 Subject: start-sim wait for the [RegionReady]: INITIALIZATION COMPLETE FOR message. --- scripts/start-sim | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/start-sim b/scripts/start-sim index 3966ac8..330b16b 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -12,6 +12,7 @@ tmux_send="${tmux_command} send-keys -t ${tmux_session}" bindir="${PRGDIR}/../bin" date=$(date '+%F_%T') quiet="" +waiting="" inventory="" function wait_for_text() @@ -36,6 +37,12 @@ then shift 1 fi +if [ "$1" = "-w" ] +then + waiting="true" + shift 1 +fi + if [ "x$1" = "x" ]; then tgt=$(basename $(pwd)) num="$(echo ${tgt} | cut -c 4-)" @@ -105,7 +112,11 @@ case $(basename $0) in fi fi - ${tmux_send}:"${title}" Enter Enter Enter + if [ ! "x$waiting" = "x" ] + then + wait_for_text "${title}" "[RegionReady]: INITIALIZATION COMPLETE FOR ${title}" + fi + ;; "backup-inventory") -- cgit v1.1 From e4199a3e68f4cdd160edcbb73a214fd116716091 Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 4 Aug 2019 02:40:12 +1000 Subject: Don't wait_for_text for anything between [], coz that's a grep thing. --- scripts/start-sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/start-sim b/scripts/start-sim index 330b16b..9f0a916 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -114,7 +114,7 @@ case $(basename $0) in if [ ! "x$waiting" = "x" ] then - wait_for_text "${title}" "[RegionReady]: INITIALIZATION COMPLETE FOR ${title}" + wait_for_text "${title}" "INITIALIZATION COMPLETE FOR ${title}" fi ;; -- cgit v1.1 From 437402c65bf941cc91e8cb773ad05be17bbe5e62 Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 4 Aug 2019 19:08:18 +1000 Subject: Minor tweak to let inventory backup script work again. --- scripts/backup-inventories.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/backup-inventories.sh b/scripts/backup-inventories.sh index db4d7f4..e4e7158 100755 --- a/scripts/backup-inventories.sh +++ b/scripts/backup-inventories.sh @@ -9,7 +9,7 @@ while read -d ';' p; do k=$(echo ${p} | cut -d '=' -f 1) v=$(echo ${p} | cut -d '=' -f 2) creds[${k}]="${v}" -done < <(grep ConnectionString ${PRGDIR}/../config/config.ini | cut -d '"' -f 2) +done < <(grep ConnectionString ${PRGDIR}/../../config/config.ini | cut -d '"' -f 2) # The above seems the best way to get bash to let the creds assignments survive outside the loop. # Only backup those that have not logged on since their last backup, but returning prims from sims will bypass this check. -- cgit v1.1 From ae3d4c0e418bb74b9ca0d3cbfa86d8abbc976d30 Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 5 Aug 2019 04:18:58 +1000 Subject: Running start-sim in scripts now starts everything up, with a delay. --- scripts/start-sim | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/start-sim b/scripts/start-sim index 9f0a916..8b8fef3 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -11,6 +11,7 @@ tmux_window="${tmux_command} select-window -t ${tmux_session}" tmux_send="${tmux_command} send-keys -t ${tmux_session}" bindir="${PRGDIR}/../bin" date=$(date '+%F_%T') +delay=60 quiet="" waiting="" inventory="" @@ -31,12 +32,18 @@ else SUDO="sudo -Hu ${OS_USER}" fi +if [ "$1" = "-d" ] +then + delay=$2 + shift 2 +fi + if [ "$1" = "-q" ] then quiet="true" shift 1 fi - + if [ "$1" = "-w" ] then waiting="true" @@ -45,6 +52,33 @@ fi if [ "x$1" = "x" ]; then tgt=$(basename $(pwd)) + if [ "$tgt" = "scripts" ]; then + uptime + pushd ${PRGDIR}/../../config/ROBUST >/dev/null + ./start-sim -w + echo "Sleeping for $((${delay} / 2)) seconds." + sleep $((${delay} / 2)) + popd > /dev/null + for i in $(seq -w 1 99) + do + j=$(num2name ${i}) + if [ -e "${PRGDIR}/../../config/${j}" ] + then + uptime + echo "Starting ${j}." + pushd ${PRGDIR}/../../config/${j} >/dev/null + ./start-sim -w + uptime + # Sleep for a while, so that there is plenty of time to finish starting scripts and such, + # and we are not keeping the computer very busy if there are lots of sims. + echo "Sleeping for ${delay} seconds." + sleep ${delay} + popd > /dev/null + fi + done + uptime + exit 0 + fi num="$(echo ${tgt} | cut -c 4-)" elif [ -d "$1" ]; then tgt=$1 @@ -70,7 +104,7 @@ if ( ${tmux_command} -q list-sessions 2>/dev/null | grep -q ${console_name}: ); else # The sudo is only so that the session is owned by opensim, otherwise it's owned by whoever ran this script, which is a likely security hole. # After the session is created, we rely on the ${PRGDIR}/../../caches/ directory to be group sticky, so that anyone in the opensim group can attach to the tmux socket. - $SUDO ${tmux_command} new-session -d -s ${console_name} -n "Server" + $SUDO ${tmux_command} new-session -d -s ${console_name} -n "ROBUST" fi -- cgit v1.1 From d642cd7a068edcc2a4965afe50d75199d7186046 Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 5 Aug 2019 04:45:02 +1000 Subject: start-sim -w waiting for ROBUST isn't working. --- scripts/start-sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/start-sim b/scripts/start-sim index 8b8fef3..f494111 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -55,7 +55,7 @@ if [ "x$1" = "x" ]; then if [ "$tgt" = "scripts" ]; then uptime pushd ${PRGDIR}/../../config/ROBUST >/dev/null - ./start-sim -w + ./start-sim echo "Sleeping for $((${delay} / 2)) seconds." sleep $((${delay} / 2)) popd > /dev/null -- cgit v1.1 From 5c2572fed212482ceed94aa22d40e38f9cf3f9aa Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 5 Aug 2019 05:05:48 +1000 Subject: Pass -q through to ROBUST on start them all mode of start-sim. --- scripts/start-sim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/start-sim b/scripts/start-sim index f494111..78e627d 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -40,13 +40,13 @@ fi if [ "$1" = "-q" ] then - quiet="true" + quiet="-q" shift 1 fi if [ "$1" = "-w" ] then - waiting="true" + waiting="-w" shift 1 fi @@ -55,7 +55,7 @@ if [ "x$1" = "x" ]; then if [ "$tgt" = "scripts" ]; then uptime pushd ${PRGDIR}/../../config/ROBUST >/dev/null - ./start-sim + ./start-sim $quiet echo "Sleeping for $((${delay} / 2)) seconds." sleep $((${delay} / 2)) popd > /dev/null -- cgit v1.1 From bab33ad24a4b960dc97eb0e179e99e52b12a1706 Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 8 Aug 2019 04:11:54 +1000 Subject: Various clean ups. --- scripts/start-sim | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/start-sim b/scripts/start-sim index 78e627d..bf6a32e 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -55,10 +55,10 @@ if [ "x$1" = "x" ]; then if [ "$tgt" = "scripts" ]; then uptime pushd ${PRGDIR}/../../config/ROBUST >/dev/null - ./start-sim $quiet + ./start-sim -q + popd > /dev/null echo "Sleeping for $((${delay} / 2)) seconds." sleep $((${delay} / 2)) - popd > /dev/null for i in $(seq -w 1 99) do j=$(num2name ${i}) @@ -68,12 +68,12 @@ if [ "x$1" = "x" ]; then echo "Starting ${j}." pushd ${PRGDIR}/../../config/${j} >/dev/null ./start-sim -w + popd > /dev/null uptime # Sleep for a while, so that there is plenty of time to finish starting scripts and such, # and we are not keeping the computer very busy if there are lots of sims. echo "Sleeping for ${delay} seconds." sleep ${delay} - popd > /dev/null fi done uptime -- cgit v1.1 From 8c34b5efe171e9f3b6daf3cefd319872684d121f Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 13 Aug 2019 01:00:58 +1000 Subject: Stop using num2name() in scripts. Turns out I was feeding "01" to it, so that's why it thought things where octal, and "01" is the result we wanted anyway. --- scripts/backup-sims.sh | 5 ++--- scripts/common.sh | 6 ++---- scripts/install/create_sim.sh | 3 +-- 3 files changed, 5 insertions(+), 9 deletions(-) (limited to 'scripts') diff --git a/scripts/backup-sims.sh b/scripts/backup-sims.sh index cadb9a2..06cb780 100755 --- a/scripts/backup-sims.sh +++ b/scripts/backup-sims.sh @@ -5,10 +5,9 @@ getPrgDir for i in $(seq -w 1 99) do - j=$(num2name ${i}) - if [ -e "${PRGDIR}/../../config/${j}" ] + if [ -e "${PRGDIR}/../../config/sim${i}" ] then - pushd ${PRGDIR}/../../config/${j} >/dev/null + pushd ${PRGDIR}/../../config/sim${i} >/dev/null # Find out the size of the last backup, base our later sleep on that, but do it now before backup-sim packs it away. sizeSleep=`sleepPerSize o "$(getSimName ${i})"` ./backup-sim diff --git a/scripts/common.sh b/scripts/common.sh index 9d985f2..6aeb8b5 100755 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -28,9 +28,7 @@ getPrgDir() # name=$(num2name 1) num2name() { - # Using a string format, coz using a number format ends with an octal error, coz 08 isn't a valid octal number. - # Why isn't octal dead already? - printf 'sim%02s' "$1" + /usr/bin/printf 'sim%02d' "$1" } @@ -46,7 +44,7 @@ sanitize() # name=$(getSimName 1) getSimName() { - grep "RegionName" ${PRGDIR}/../../config/$(num2name $1)/*.ini | head -n 1 | cut -d '"' -f 2 + grep "RegionName" ${PRGDIR}/../../config/sim$1/*.ini | head -n 1 | cut -d '"' -f 2 } diff --git a/scripts/install/create_sim.sh b/scripts/install/create_sim.sh index 055f802..0aa0941 100755 --- a/scripts/install/create_sim.sh +++ b/scripts/install/create_sim.sh @@ -13,8 +13,7 @@ cd ${OS_PATH}/config k=0 for i in $(seq -w 1 99) do - j=$(num2name "$i") - if [ -e "$j" ] + if [ -e "sim$j" ] then k=$i fi -- cgit v1.1 From c25dbbfc4447898fac20ab58a8e74bb5a6ee5f76 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 13 Aug 2019 01:01:56 +1000 Subject: Modify start-sim to start up everything, with the output in the left tmux window. --- scripts/start-sim | 63 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 39 insertions(+), 24 deletions(-) (limited to 'scripts') diff --git a/scripts/start-sim b/scripts/start-sim index bf6a32e..3e03911 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -11,6 +11,7 @@ tmux_window="${tmux_command} select-window -t ${tmux_session}" tmux_send="${tmux_command} send-keys -t ${tmux_session}" bindir="${PRGDIR}/../bin" date=$(date '+%F_%T') +all="" delay=60 quiet="" waiting="" @@ -32,6 +33,12 @@ else SUDO="sudo -Hu ${OS_USER}" fi +if [ "$1" = "-a" ] +then + all="-a" + shift 1 +fi + if [ "$1" = "-d" ] then delay=$2 @@ -52,31 +59,35 @@ fi if [ "x$1" = "x" ]; then tgt=$(basename $(pwd)) + # These checks are kludgy. if [ "$tgt" = "scripts" ]; then + all="-a" + cd ${PRGDIR}/../../config/ROBUST + tgt="ROBUST" + fi + if [ "$tgt" = "bin" ]; then uptime - pushd ${PRGDIR}/../../config/ROBUST >/dev/null - ./start-sim -q - popd > /dev/null - echo "Sleeping for $((${delay} / 2)) seconds." - sleep $((${delay} / 2)) - for i in $(seq -w 1 99) - do - j=$(num2name ${i}) - if [ -e "${PRGDIR}/../../config/${j}" ] - then - uptime - echo "Starting ${j}." - pushd ${PRGDIR}/../../config/${j} >/dev/null - ./start-sim -w - popd > /dev/null - uptime - # Sleep for a while, so that there is plenty of time to finish starting scripts and such, - # and we are not keeping the computer very busy if there are lots of sims. - echo "Sleeping for ${delay} seconds." - sleep ${delay} - fi - done - uptime + wait_for_text "ROBUST" "INITIALIZATION COMPLETE FOR ROBUST" + if [ ! "x$all" = "x" ] + then + echo "Sleeping for $((${delay} / 2)) seconds." + sleep $((${delay} / 2)) + for i in $(seq -w 1 99) + do + if [ -e "${PRGDIR}/../../config/sim${i}" ] + then + uptime + echo "Starting sim${i}." + cd ${PRGDIR}/../../config/sim${i}; ./start-sim -w + uptime + # Sleep for a while, so that there is plenty of time to finish starting scripts and such, + # and we are not keeping the computer very busy if there are lots of sims. + echo "Sleeping for ${delay} seconds." + sleep ${delay} + fi + done + uptime + fi exit 0 fi num="$(echo ${tgt} | cut -c 4-)" @@ -139,6 +150,11 @@ case $(basename $0) in fi fi + if [ ! "x$all" = "x" ] + then + ${tmux_send}:ROBUST.{left} "../scripts/start-sim -a" Enter + fi + if [ "x$quiet" = "x" ] then if [ "x$tgt" = "xROBUST" ]; then @@ -150,7 +166,6 @@ case $(basename $0) in then wait_for_text "${title}" "INITIALIZATION COMPLETE FOR ${title}" fi - ;; "backup-inventory") -- cgit v1.1 From b972846c5f7abf0deead2876c646c039a60df38a Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 13 Aug 2019 03:02:02 +1000 Subject: Make [Region] InternalAddress and ExternalHostName reasonable defaults. Also AllowAlternatePorts isn't actually in the code anywhere, get rid of it. --- scripts/install/create_sim.sh | 9 --------- 1 file changed, 9 deletions(-) (limited to 'scripts') diff --git a/scripts/install/create_sim.sh b/scripts/install/create_sim.sh index 0aa0941..71aabc7 100755 --- a/scripts/install/create_sim.sh +++ b/scripts/install/create_sim.sh @@ -38,14 +38,6 @@ then SIZE="256" fi -if [ "x${IP}" = "x" ] -then - IP="0.0.0.0" - echo "WARNING setting the InternalAddress to ${IP}, this may not be what you want." -# echo " 0.0.0.0 will work for a single sim per physical machine, otherwise we need the real internal IP." -# According to the OpenSim docs, 0.0.0.0 means to listen on all NICs the machine has, which should work fine. -fi - # Wow, the hoops we have to jump through to avoid octal. if [ 9 -gt $k ]; then NUM=$(printf '0%1s' $(( 10#$k + 1 )) ) @@ -64,7 +56,6 @@ cd sim${NUM} sed -i "s@SIM_NAME@${NAME}@g" ThisSim.ini sed -i "s@SIM_UUID@${UUID}@g" ThisSim.ini sed -i "s@SIM_POS@${LOCATION}@g" ThisSim.ini -sed -i "s@SIM_IP@${IP}@g" ThisSim.ini sed -i "s@SIM_INT_PORT@$(( ${PORT} + 1 ))@g" ThisSim.ini sed -i "s@SIM_SIZE@${SIZE}@g" ThisSim.ini -- cgit v1.1 From ba62b2817f323de67b5b1a220300c040a8bdb7ec Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 13 Aug 2019 03:10:44 +1000 Subject: Whitespace-- --- scripts/start-sim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/start-sim b/scripts/start-sim index 3e03911..724f81b 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -56,7 +56,7 @@ then waiting="-w" shift 1 fi - + if [ "x$1" = "x" ]; then tgt=$(basename $(pwd)) # These checks are kludgy. -- cgit v1.1 From 2ad73482b8b635707f77160a9538252b7f66ad32 Mon Sep 17 00:00:00 2001 From: onefang Date: Tue, 13 Aug 2019 03:11:45 +1000 Subject: ThisSim.ini -> Actual_Name.ini And a minor typo I'm suprised survived. --- scripts/install/create_sim.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/install/create_sim.sh b/scripts/install/create_sim.sh index 71aabc7..6af49ac 100755 --- a/scripts/install/create_sim.sh +++ b/scripts/install/create_sim.sh @@ -13,7 +13,7 @@ cd ${OS_PATH}/config k=0 for i in $(seq -w 1 99) do - if [ -e "sim$j" ] + if [ -e "sim$i" ] then k=$i fi @@ -70,5 +70,7 @@ sed -i "s@SIM_PORT@${PORT}@g" ThisSim.ini sed -i "s@OS_PATH@${OS_PATH}@g" opensim-monit.conf sed -i "s@SIM_NUMBER@${NUM}@g" opensim-monit.conf +mv ThisSim.ini $(sanitize "${NAME}").ini + sudo chown -R ${OS_USER}:${OS_USER} .. sudo chmod -R g+w .. -- cgit v1.1 From 72cf78a629496102d3edc8050ac907dfb9ce7347 Mon Sep 17 00:00:00 2001 From: onefang Date: Mon, 19 Aug 2019 19:47:34 +1000 Subject: TYPO-- --- scripts/install/opensim.tmux.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/install/opensim.tmux.conf b/scripts/install/opensim.tmux.conf index a5088aa..b7c61c9 100644 --- a/scripts/install/opensim.tmux.conf +++ b/scripts/install/opensim.tmux.conf @@ -75,7 +75,7 @@ set-option -g status-left-length 80 #set-option -g status-left '[#H #S #F]' set-option -g status-left '#H [#S:#I.#P]#F' set-option -g status-right-length 80 -set-option -g status-right '%F #(uptime)'<-----># &F is ISO date, uptime starts with the current time, and ends with the load average. B-) +set-option -g status-right '%F #(uptime)' # &F is ISO date, uptime starts with the current time, and ends with the load average. B-) # Set window notifications set-option -g visual-activity on # Show status message for activity in monitor-activity windows. -- cgit v1.1 From 03e5a31e64cbb51113816454928f57b3095b28cb Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 22 Aug 2019 08:58:53 +1000 Subject: Unclutter the tmux status line. Not everyone has YUUUGE terminals like I do. --- scripts/install/opensim.tmux.conf | 6 +++--- scripts/show-console | 2 +- scripts/start-sim | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/install/opensim.tmux.conf b/scripts/install/opensim.tmux.conf index b7c61c9..84e0c21 100644 --- a/scripts/install/opensim.tmux.conf +++ b/scripts/install/opensim.tmux.conf @@ -71,11 +71,11 @@ set-option -g status-justify centre # Window list in the middle. ## A literal ‘#’ # Yes, my terminal really is bigger than 160 characters. -set-option -g status-left-length 80 +set-option -g status-left-length 42 #set-option -g status-left '[#H #S #F]' set-option -g status-left '#H [#S:#I.#P]#F' -set-option -g status-right-length 80 -set-option -g status-right '%F #(uptime)' # &F is ISO date, uptime starts with the current time, and ends with the load average. B-) +set-option -g status-right-length 64 +set-option -g status-right "%F #(uptime | cut -d ' ' -f 2-2,10-)" # %F is ISO date, uptime starts with the current time, and ends with the load average. B-) # Set window notifications set-option -g visual-activity on # Show status message for activity in monitor-activity windows. diff --git a/scripts/show-console b/scripts/show-console index 5818e70..e7fb941 100755 --- a/scripts/show-console +++ b/scripts/show-console @@ -1,3 +1,3 @@ #!/bin/bash -tmux -S ../../caches/opensim-tmux.socket select-window -t "OpenSimSC_console" \; attach-session -t "OpenSimSC_console" +tmux -S ../../caches/opensim-tmux.socket select-window -t "OpenSimSC" \; attach-session -t "OpenSimSC" diff --git a/scripts/start-sim b/scripts/start-sim index 724f81b..3c1fc2f 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -4,7 +4,7 @@ source common.sh getPrgDir USER=$(whoami) -console_name="OpenSimSC_console" +console_name="OpenSimSC" tmux_command="tmux -S ${PRGDIR}/../../caches/opensim-tmux.socket" tmux_session=${console_name} tmux_window="${tmux_command} select-window -t ${tmux_session}" -- cgit v1.1 From fcbf28bd9e65c5f2a4d5d0eabdf813f1a642a1dd Mon Sep 17 00:00:00 2001 From: onefang Date: Thu, 22 Aug 2019 17:01:31 +1000 Subject: config/ROBUST/RobustExtra.ini --- scripts/install/secure.sh | 2 ++ 1 file changed, 2 insertions(+) (limited to 'scripts') diff --git a/scripts/install/secure.sh b/scripts/install/secure.sh index 43ed679..95aae84 100755 --- a/scripts/install/secure.sh +++ b/scripts/install/secure.sh @@ -4,6 +4,7 @@ source ../common.sh echo "Securing OpenSim." sudo chmod 600 ${OS_PATH}/config/*.ini +sudo chmod 600 ${OS_PATH}/config/ROBUST/*.ini sudo chown -R ${OS_USER}:${OS_USER} ${OS_PATH} sudo chmod -R 775 ${OS_PATH} sudo chmod -R a-x ${OS_PATH} @@ -18,6 +19,7 @@ sudo chmod a+x ${OS_PATH}/current/scripts/start-sim sudo chmod ug+rwx ${OS_PATH}/config sudo chmod g+s ${OS_PATH}/config sudo chmod 600 ${OS_PATH}/config/*.ini +sudo chmod 600 ${OS_PATH}/config/ROBUST/*.ini chmod ug+rwx ${OS_PATH}/caches chmod o-rwx ${OS_PATH}/caches -- cgit v1.1 From b80f39d864ff9dc975b4ef14f4aa39c812b7f005 Mon Sep 17 00:00:00 2001 From: onefang Date: Fri, 23 Aug 2019 16:28:22 +1000 Subject: We don't use IP in create-sim anymore. --- scripts/install/create_sim.sh | 1 - 1 file changed, 1 deletion(-) (limited to 'scripts') diff --git a/scripts/install/create_sim.sh b/scripts/install/create_sim.sh index 6af49ac..b940315 100755 --- a/scripts/install/create_sim.sh +++ b/scripts/install/create_sim.sh @@ -6,7 +6,6 @@ getPrgDir NAME=$1 LOCATION=$2 SIZE=$3 -IP=$4 cd ${OS_PATH}/config -- cgit v1.1 From 40bdf0506c08e980164c35a0d54cbb2d1680f890 Mon Sep 17 00:00:00 2001 From: onefang Date: Sun, 25 Aug 2019 09:21:59 +1000 Subject: Make start-sim -d 30 actually work. --- scripts/start-sim | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/start-sim b/scripts/start-sim index 3c1fc2f..48c530a 100755 --- a/scripts/start-sim +++ b/scripts/start-sim @@ -12,7 +12,7 @@ tmux_send="${tmux_command} send-keys -t ${tmux_session}" bindir="${PRGDIR}/../bin" date=$(date '+%F_%T') all="" -delay=60 +delay=45 quiet="" waiting="" inventory="" @@ -152,7 +152,7 @@ case $(basename $0) in if [ ! "x$all" = "x" ] then - ${tmux_send}:ROBUST.{left} "../scripts/start-sim -a" Enter + ${tmux_send}:ROBUST.{left} "../scripts/start-sim -a -d ${delay}" Enter fi if [ "x$quiet" = "x" ] -- cgit v1.1