Commit 136bcbdd authored by Sean Rhone's avatar Sean Rhone
Browse files

- Add systemd scripts for auth, world, automatic restart, and update

- Remove content folders from host after transferred
- Remove legacy scripts, descriptions, etc
parent f474d212
Loading
Loading
Loading
Loading
+84 −79
Original line number Diff line number Diff line
@@ -158,7 +158,7 @@ sudo zypper --non-interactive install 'libboost_filesystem1_60_0' 'libboost_prog
%%%%% Send Content
%%%%%%%%%%%%%%%%%%%%

scp -r '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/dbc' '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/maps' '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/vmaps' '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/mmaps' trinity@192.168.1.152:'/srv/trinity/run/bin'
scp -r '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/dbc' '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/maps' '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/vmaps' '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/mmaps' trinity@192.168.1.152:'/srv/trinity/run/bin' && rm -R '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/Buildings' '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/dbc' '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/maps' '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/mmaps' '/home/espionage724/Wine Prefixes/World of Warcraft/drive_c/Program Files/World of Warcraft/vmaps' && sync

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -240,65 +240,6 @@ GRANT SELECT, UPDATE on auth.account to 'soap'@'%' IDENTIFIED BY 'X';
FLUSH PRIVILEGES;
EXIT

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%
%%%%% Script Setup
%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

TODO: Get rid of this and use systemd scripts

%%%%%%%%%%%%%%%%%%%%
%%%%% authserver
%%%%%%%%%%%%%%%%%%%%

nano '/home/espionage724/auth.sh' && chmod +x '/home/espionage724/auth.sh'

-------------------------
cd '/home/espionage724/run/bin'
screen -dmS auth '/home/espionage724/run/bin/authserver'
-------------------------

%%%%%%%%%%%%%%%%%%%%
%%%%% worldserver
%%%%%%%%%%%%%%%%%%%%

nano '/home/espionage724/world.sh' && chmod +x '/home/espionage724/world.sh'

-------------------------
cd '/home/espionage724/run/bin'
screen -dmS world '/home/espionage724/run/bin/worldserver'
-------------------------

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%
%%%%% Execute
%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%
%%%%% Information
%%%%%%%%%%%%%%%%%%%%

- Starts authserver and worldserver in dedicated screen sessions and changes Terminal over to its respective screen session
- To leave screen session without closing program; hit Ctrl + A and D (hold Ctrl and then press A and D at the same time)

%%%%%%%%%%%%%%%%%%%%
%%%%% authserver
%%%%%%%%%%%%%%%%%%%%

'/home/espionage724/auth.sh' && screen -r auth

%%%%%%%%%%%%%%%%%%%%
%%%%% worldserver
%%%%%%%%%%%%%%%%%%%%

'/home/espionage724/world.sh' && screen -r world

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%
@@ -308,8 +249,7 @@ screen -dmS world '/home/espionage724/run/bin/worldserver'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%
%%%%% Main Administrator
%%%%% Do from worldserver console
%%%%% Main
%%%%%%%%%%%%%%%%%%%%

account create Espionage724 X
@@ -317,7 +257,6 @@ account set gmlevel Espionage724 3 -1

%%%%%%%%%%%%%%%%%%%%
%%%%% SOAP
%%%%% Do from worldserver console
%%%%%%%%%%%%%%%%%%%%

account create soap X
@@ -328,20 +267,17 @@ rbac account grant soap 228 -1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%
%%%%% systemd Startup Scripts
%%%%% systemd Scripts
%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

TODO: Call screen directly and drop the scripts; also add update and reboot script; do 1hour and 30min between update and reboot instead of just 30min
    use 2 cores for compile on script

%%%%%%%%%%%%%%%%%%%%
%%%%% Notes
%%%%%%%%%%%%%%%%%%%%

- Autostarts authserver and worldserver via scripts created above (and thus, in their own screen session)
- Use auth and world for addressing service names for use with status and service management
- Updater happens daily at 3:00 AM EST
- Restarter happens daily at 4:30 AM EST

%%%%%%%%%%%%%%%%%%%%
%%%%% authserver
@@ -356,10 +292,10 @@ After=network.target

[Service]
Type=forking
User=espionage724
Group=espionage724
WorkingDirectory=/home/espionage724/run/bin
ExecStart=/bin/bash /home/espionage724/auth.sh start
User=trinity
Group=trinity
WorkingDirectory=/srv/trinity/run/bin
ExecStart='/usr/bin/screen' -dmS 'auth' '/srv/trinity/run/bin/authserver'
Restart=always
RestartSec=5

@@ -380,10 +316,10 @@ After=network.target

[Service]
Type=forking
User=espionage724
Group=espionage724
WorkingDirectory=/home/espionage724/run/bin
ExecStart=/bin/bash /home/espionage724/world.sh start
User=trinity
Group=trinity
WorkingDirectory=/srv/trinity/run/bin
ExecStart='/usr/bin/screen' -dmS 'world' '/srv/trinity/run/bin/worldserver'
Restart=always
RestartSec=5

@@ -392,10 +328,79 @@ WantedBy=multi-user.target
-------------------------

%%%%%%%%%%%%%%%%%%%%
%%%%% Enable Services
%%%%% Updater
%%%%%%%%%%%%%%%%%%%%

sudo -e '/usr/lib/systemd/system/tc-up.service'

-------------------------
[Service]
User=trinity
Group=trinity
Type=oneshot
WorkingDirectory=/srv/trinity/build
ExecStart='/usr/bin/git' -C '/srv/trinity/src' pull origin '3.3.5'
ExecStart='/usr/bin/cmake' '/srv/trinity/src' -DCMAKE_INSTALL_PREFIX='/srv/trinity/run' -DTOOLS=1 -DCMAKE_CXX_FLAGS='-O3 -pipe -march=native -mtune=native' -DCMAKE_C_FLAGS='-O3 -pipe -march=native -mtune=native'
ExecStart='/usr/bin/make' -j3 install
-------------------------

sudo -e '/usr/lib/systemd/system/tc-up.timer'

-------------------------
[Unit]
Description=Daily TrinityCore Updater

[Timer]
OnCalendar=*-*-* 03:00:00
Persistent=true

[Install]
WantedBy=timers.target
-------------------------

%%%%%%%%%%%%%%%%%%%%
%%%%% Restarter
%%%%%%%%%%%%%%%%%%%%

sudo systemctl daemon-reload && sudo systemctl enable 'tc-auth' 'tc-world'
sudo -e '/usr/lib/systemd/system/tc-re.service'

-------------------------
[Service]
Type=oneshot
ExecStart='/bin/systemctl' restart 'tc-auth'
ExecStart='/bin/systemctl' restart 'tc-world'
-------------------------

sudo -e '/usr/lib/systemd/system/tc-re.timer'

-------------------------
[Unit]
Description=Daily TrinityCore Restarter

[Timer]
OnCalendar=*-*-* 04:30:00
Persistent=true

[Install]
WantedBy=timers.target
-------------------------

%%%%%%%%%%%%%%%%%%%%
%%%%% Enable and Start Services
%%%%%%%%%%%%%%%%%%%%

sudo systemctl daemon-reload && sudo systemctl enable 'tc-auth' 'tc-world' 'tc-up.timer' 'tc-re.timer' && sudo systemctl start 'tc-auth' 'tc-world' 'tc-up.timer' 'tc-re.timer'

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%
%%%%% Screen Sessions
%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

sudo -u 'trinity' screen -r 'auth'
sudo -u 'trinity' screen -r 'world'

####################################################################################################
####################################################################################################