install scripts

This commit is contained in:
jmosrael@gmail.com
2024-07-18 21:07:20 -07:00
parent bc3455f5d0
commit d6de4e55e8
2 changed files with 30 additions and 7 deletions

View File

@@ -1,11 +1,30 @@
#!/bin/bash
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
echo ""
echo "---"
echo "Creating user rushstats"
echo "---"
if [id rushstats >/dev/null 2>&1]; then
echo "rushstats user already exists, skipping."
else
useradd -s /sbin/nologin rushstats
echo "User rushstats created with /sbin/nologin"
fi
echo ""
echo "---"
echo "Moving the distributable folder into /srv/gamestats"
echo "---"
cp -r "$parent_path"/dist /srv/gamestats
if [ -d /srv/gamestats ]; then
echo "/srv/gamestats already exists; removing"
rm -r /srv/rushstats
fi
mkdir /srv/gamestats
cp -r "$parent_path"/dist /srv/gamestats
cp -r "$parent_path"/loader /srv/gamestats
chown -r /srv/gamestats rushstats rushstats
echo ""
echo "---"
@@ -31,14 +50,18 @@ echo "[Install]" >> $SYSTEMD_SERVICE_FILE
echo "WantedBy=multi-user.target" >> $SYSTEMD_SERVICE_FILE
echo "" >> $SYSTEMD_SERVICE_FILE
echo ""
echo "---"
echo "Creating the cron job to refresh the database."
echo "---"
echo "Created new service."
echo cat $SYSTEMD_SERVICE_FILE
echo ""
echo "---"
echo "Reloading daemons and starting service"
echo "---"
systemctl daeomon-reload
systemctl enable rushstats.service
systemctl start rushstats.service
echo ""
echo "---"
echo "Creating the cron job to refresh the database."
echo "---"

View File

@@ -22,7 +22,7 @@ cp -f ./backend/dist/* ./dist
cd "$parent_path"/loader
python3 createrushdatabase.py
cd ../
cp -r ./loader/testdb.db ./dist/testdb.db
cp -r ./loader/* ./dist
# Move the package into the dist folder and install the needed modules
cd "$parent_path"