Implement install and update system for the bot
- LINUX OR WINDOW WSL ONLY
This commit is contained in:
@@ -5,6 +5,16 @@ if [ "$EUID" -ne 0 ]
|
||||
then echo "Please run as root"
|
||||
exit
|
||||
fi
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
|
||||
ls -ld $SCRIPT_DIR | awk '{print $3}' >> ./config/installerName
|
||||
|
||||
# Setup user for service
|
||||
useradd -M RadioNode
|
||||
usermod -s -L RadioNode
|
||||
|
||||
# Change the ownership of the directory to the service user
|
||||
chown RadioNode -R $SCRIPT_DIR
|
||||
|
||||
# Check for updates
|
||||
apt-get update
|
||||
@@ -26,4 +36,41 @@ pulseaudio
|
||||
npm i
|
||||
|
||||
# Install the python packages needed for the bot
|
||||
pip install -r
|
||||
pip install -r
|
||||
|
||||
# Setup bot service
|
||||
echo "[Unit]
|
||||
Description=Radio Node Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=
|
||||
ExecStart=/usr/bin/node .
|
||||
Restart=always
|
||||
RestartDelay=10
|
||||
User=RadioNode
|
||||
Environment=DEBUG='server:*'
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target" >> /etc/systemd/system/RadioNode.service
|
||||
|
||||
# Setup bot update service
|
||||
echo "[Unit]
|
||||
Description=Radio Node Updater Service
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=
|
||||
ExecStart=/usr/bin/node .
|
||||
Restart=on-failure
|
||||
User=RadioNode
|
||||
Environment=DEBUG='server:*'
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target" >> /etc/systemd/system/RadioNodeUpdater.service
|
||||
|
||||
# Enable the service
|
||||
systemctl enable RadioNode.service
|
||||
|
||||
# Start the service
|
||||
systemctl start RadioNode.service
|
||||
Reference in New Issue
Block a user