Bootstrap Framework 3.3.6

Over a dozen reusable components built to provide iconography, dropdowns, input groups, navigation, alerts, and much more...

Publish your tools and modifications here.
#5355
Liebe TS3Musicbot Community!

Ich bin schon lange auf der Suche nach einem Startscript für den TS3Musicbot. Habe hier im Forum eines gefunden gehabt, dieses war aber unvollständig :x . Deswegen habe ich ein eigenes zusammengestellt. Das möchte ich euch aber nicht vorenthalten. :mrgreen:

Mein OS: Ubuntu 14.04 LTS

Packages die ihr braucht: openjdk-7-jre, screen, nano

Falls Ihr die nicht habt einfach sudo apt-get install openjdk-7-jre screen nano

Musikbot Start.sh:
(1.4 KiB) Downloaded 1232 times
NEUES UPDATE: MIT QUERY TAUSCH FUNKTION 12.12.14

Service Datei: Wenn ihr die wollt in die Kommentare schreiben

Um diese Auszuführen packt Ihr die musikradio.sh in den Ordner wo die TS3Musicbot_runscript.sh ist.

Hochladen via FTP oder SFTP [Filezilla ist meine Empfehlung]

BOT TUTORIAL:

Nur von Anfang an nie irgendwelche Programme mit ROOT starten! Falls Ihr dies habt erstellt einfach einen user mit
Code: Select all
adduser ts3bot
gebt ihn ein Passwort und Skipt Full Name und so mit ENTER durch

Ihr geht in
Code: Select all
cd /home/ts3bot
Erstellt einen Ordner mit
Code: Select all
mkdir ts3bot
oder wie ihr wollt

Wechselt in das Verzechnis mit
Code: Select all
cd ts3bot
Installiert den Bot mit der Anleitung und dem User ts3bot: http://www.ts3musicbot.net/index.php?mode=account#

Lädt euch die musikradio.sh in den Ordner hoch und macht
Code: Select all
chown ts3bot:ts3bot musikradio.sh
und anschließend
Code: Select all
chmod +x musikradio.sh
Ihr öffnet die Shell Datei mit
Code: Select all
nano musikradio.sh
Ihr editiert die Start Datei wie in ihr Beschrieben

Danach startet Ihr die musikradio.sh mit den Command mit egal ob mit ts3bot oder root (Da der Bot immer mit ts3bot gestartet wird
Code: Select all
./musikradio start
,
Code: Select all
/home/ts3bot/ts3bot/musikradio start
oder
Code: Select all
sh musikradio start
Danach sollte der Bot ohne Fehler starten :geek:

Um ihn zu stoppen oder neuzustarten, erstetzt start mit restart oder stop

Bei Fragen oder Probleme einfach in die Kommentare schreiben :mrgreen:

Ich habe mir viel Arbeit gemacht. Verlinkt dieses Tutorial und kopiert nicht meine musikradio.sh und gebt es als eure aus! Danke

SERVICE TUTORIAL

Wenn ihr die auch wollt in die Kommentare schreiben :D
#11537
Does anyone have something like this that will work as a service with systemctl?

This script works great when I manually run it myself but when I try to add it as a service the bot never starts up even though the status shows as success.


matthew@ts3bot-server:~$ sudo systemctl status ts3bot1
● ts3bot1.service - TS3 MusicBot1
Loaded: loaded (/usr/lib/systemd/system/ts3bot1.service; enabled; preset: enabled)
Active: activating (auto-restart) since Thu 2024-08-15 02:30:10 UTC; 8s ago
Process: 141062 ExecStart=/home/ts3bot/TS3MusicBot/TS3MusicBot_script.sh start (code=exited, status=0/SUCCESS)
Process: 141085 ExecStop=/home/ts3bot/TS3MusicBot/TS3MusicBot_script.sh stop (code=exited, status=0/SUCCESS)
Main PID: 141062 (code=exited, status=0/SUCCESS)
CPU: 14ms
matthew@ts3bot-server:~$
#11554
1. Shell Script (ts3musicbot_service.sh)
Create a new shell script named ts3musicbot_service.sh. This script will contain variables for customization:
Code: Select all
#!/bin/bash

# Configuration variables
ACCOUNT="your@email.xy"
PORT="8080"
WEBIF_PW="ADMIN_PASSWORD"
WEBIF_PW_USER="USER_PASSWORD"
NOQUERY="-noquery"  # Set to "" if you don't want to use this flag
ADDITIONAL_ARGUMENTS="" # Here you can set additional startup arguments separated by spaces
RUNSCRIPT_PATH="/absolute/path/to/TS3MusicBot_runscript.sh"

# Start the TS3MusicBot
start_bot() {
    screen -dmS "MusicBot_$PORT" $RUNSCRIPT_PATH -account "$ACCOUNT" -port "$PORT" -webif-pw "$WEBIF_PW" -webif-pw-user "$WEBIF_PW_USER" $NOQUERY $ADDITIONAL_ARGUMENTS
}

# Stop the TS3MusicBot
stop_bot() {
    pkill -f "MusicBot_$PORT"
    sleep 2
    pkill -9 -f "MusicBot_$PORT"
}

# Restart the TS3MusicBot
restart_bot() {
    stop_bot
    sleep 2
    start_bot
}

# Handle command line arguments
case "$1" in
    start)
        start_bot
        ;;
    stop)
        stop_bot
        ;;
    restart)
        restart_bot
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac

Make the script executable:
Code: Select all
chmod +x ts3musicbot_service.sh


2. Systemd Service Unit File (/etc/systemd/system/ts3musicbot.service)
Now, create a Systemd service file to manage your script:
Code: Select all
[Unit]
Description=TS3MusicBot Service
After=network.target

[Service]
Type=forking
ExecStart=/absolute/path/to/ts3musicbot_service.sh start
ExecStop=/absolute/path/to/ts3musicbot_service.sh stop
ExecReload=/absolute/path/to/ts3musicbot_service.sh restart
PIDFile=/run/ts3musicbot.pid
User=your_user  # Change to the user that should run the script

[Install]
WantedBy=multi-user.target
Replace /absolute/path/to/ts3musicbot_service.sh with the actual path to your shell script.



3. Reload Systemd, Enable, and Start the Service
Run the following commands to reload Systemd, enable your service at boot, and start it:
Code: Select all
sudo systemctl daemon-reload
sudo systemctl enable ts3musicbot.service
sudo systemctl start ts3musicbot.service



4. Managing the Service
You can now use the following commands to manage your service:

Start: sudo systemctl start ts3musicbot
Stop: sudo systemctl stop ts3musicbot
Restart: sudo systemctl restart ts3musicbot
Status: sudo systemctl status ts3musicbot

In the vast and immersive world of Throne and Libe[…]

It seems like you're providing a comprehensive gui[…]

EA Sports FC 24: A New Chapter in the Evolution of[…]

1. Shell Script (ts3musicbot_service.sh) Create […]

Swap-in out addons, use only what you really need!