Screenshot Youtube tends to breake yt-dlp and I’m rarely using my teamspeak musicbot sinsbot, but when I do, I don’t want to also manually update yt-dlp just to listen to some music.

So let’s automate it, I decided to go with a .service and a .sh file for this.

yt-dl-updater.sh

#!/bin/bash
wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp
mv yt-dlp /opt/sinusbot/youtube-dl
chmod a+rx youtube-dl
chown sinusbot youtube-dl
chown sinusbot:sinusbot youtube-dl

yt-dl.service

[Unit]
Description=yt-dl updater
After=network-online.target

[Service]
ExecStart=/root/yt-dl-updater.sh

[Install]
WantedBy=multi-user.target

Followed by

systemctl daemon-reload 
systemctl enable yt-dl.service
systemctl start yt-dl.service

Info

This service will only run once, at system boot. It suits my usecase but that doesn’t mean it will suit yours. Adding a second service with the .timer ending, could help when your server is online 24/7.