Dateien nach "/" hochladen
This commit is contained in:
		
							
								
								
									
										70
									
								
								setup.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								setup.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,70 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# Überprüfen, ob Node.js installiert ist
 | 
			
		||||
if ! command -v node &> /dev/null; then
 | 
			
		||||
    echo "Node.js ist nicht installiert. Installiere Node.js automatisch..."
 | 
			
		||||
 | 
			
		||||
    # Automatische Installation von Node.js, abhängig vom Linux-System
 | 
			
		||||
    if command -v apt &> /dev/null; then
 | 
			
		||||
        sudo apt update
 | 
			
		||||
        sudo apt install -y nodejs
 | 
			
		||||
    elif command -v yum &> /dev/null; then
 | 
			
		||||
        sudo yum install -y nodejs
 | 
			
		||||
    else
 | 
			
		||||
        echo "Automatische Installation von Node.js wird nicht unterstützt. Bitte installieren Sie Node.js manuell und führen Sie das Skript erneut aus."
 | 
			
		||||
        exit 1
 | 
			
		||||
    fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Überprüfen, ob npm installiert ist
 | 
			
		||||
if ! command -v npm &> /dev/null; then
 | 
			
		||||
    echo "npm ist nicht installiert. Installiere npm automatisch..."
 | 
			
		||||
    sudo apt install -y npm  # Oder passen Sie dies an Ihr System an
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Laden Sie die Umgebungsvariablen aus der .env-Datei
 | 
			
		||||
source .env
 | 
			
		||||
 | 
			
		||||
# Erstellen Sie ein neues Node.js-Projekt mit npm init und verwenden Sie Umgebungsvariablen
 | 
			
		||||
echo -e "Creating a new Node.js project..."
 | 
			
		||||
echo -e "Project name: $PROJECT_NAME"
 | 
			
		||||
echo -e "Version: 1.0.0"
 | 
			
		||||
echo -e "Description: Node.js project"
 | 
			
		||||
echo -e "Entry point: support_bot.js"  # Hier Dateinamen anpassen
 | 
			
		||||
echo -e "Test command: "
 | 
			
		||||
echo -e "Git repository: https://git.viper.ipv64.net/M_Viper/telegram_server_monitoring"
 | 
			
		||||
echo -e "Keywords: "
 | 
			
		||||
echo -e "Author: M_Viper"
 | 
			
		||||
echo -e "License: ISC"
 | 
			
		||||
 | 
			
		||||
# npm init -y sollte ohne sudo ausgeführt werden, um Probleme mit Dateiberechtigungen zu vermeiden
 | 
			
		||||
sudo npm init -y
 | 
			
		||||
 | 
			
		||||
# Installieren Sie die benötigten Pakete, einschließlich node-telegram-bot-api
 | 
			
		||||
sudo npm install
 | 
			
		||||
sudo npm install ping
 | 
			
		||||
sudo npm install node-telegram-bot-api  
 | 
			
		||||
sudo npm install js-yaml
 | 
			
		||||
sudo npm install moment
 | 
			
		||||
sudo npm install yaml  # Änderung: 'yaml' anstelle von 'yml'
 | 
			
		||||
sudo npm install dotenv
 | 
			
		||||
sudo npm install fs
 | 
			
		||||
sudo npm install request
 | 
			
		||||
sudo npm install nodemailer
 | 
			
		||||
sudo npm install axios
 | 
			
		||||
 | 
			
		||||
# Installieren Sie pm2, wenn es noch nicht installiert ist
 | 
			
		||||
if ! command -v pm2 &> /dev/null; then
 | 
			
		||||
    sudo npm install -g pm2
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Erstellen Sie ein Startskript für den Bot
 | 
			
		||||
echo -e "Creating start script..."
 | 
			
		||||
echo -e "#!/bin/bash\n\npm2 start support_bot.js" > start_bot.sh  # Hier Dateinamen anpassen
 | 
			
		||||
chmod +x start_bot.sh
 | 
			
		||||
 | 
			
		||||
# Erstellen Sie ein Autostart-Skript für den Bot
 | 
			
		||||
echo -e "Creating autostart script..."
 | 
			
		||||
echo -e "[Unit]\nDescription=Telegram Support Bot\n\n[Service]\nExecStart=$(pwd)/start_bot.sh\n\n[Install]\nWantedBy=default.target" > telegram_bot.service
 | 
			
		||||
sudo mv telegram_bot.service /etc/systemd/system/
 | 
			
		||||
sudo systemctl enable telegram_bot
 | 
			
		||||
							
								
								
									
										3
									
								
								start_bot.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								start_bot.sh
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,3 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
pm2 start support_bot.js
 | 
			
		||||
		Reference in New Issue
	
	Block a user