-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
41 lines (34 loc) · 1.05 KB
/
install.sh
File metadata and controls
41 lines (34 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
#By Pytel
# check if pip is installed
if ! [ -x "$(command -v pip)" ]; then
echo 'Error: pip is not installed.' >&2
exit 1
fi
# install required libraries
echo "Installing required libraries..."
pip install -r requirements.txt
# create config file
echo "Creating config file..."
touch config.json
python3 bot.py --config
# check if systemd is installed
if ! [ -x "$(command -v systemctl)" ]; then
echo 'Error: systemctl is not installed.' >&2
exit 1
fi
# change path to script
echo "Changing path to script..."
sed -i "s|<path>|$(pwd)|g" ./discordBashAccessor.service
# set up system service
echo "Setting up system service..."
sudo cp ./discordBashAccessor.service /etc/systemd/system/discordBashAccessor.service
sudo systemctl daemon-reload
sudo systemctl enable discordBashAccessor.service
sudo systemctl start discordBashAccessor.service
# check if service is running
if ! systemctl is-active --quiet discordBashAccessor.service; then
echo 'Error: discordBashAccessor.service is not running.' >&2
exit 1
fi
echo "Installation completed."