Later but if anyone is looking for the script, this my service in Debian/Ubuntu based compact recorder:
First, I create a bash script in /bin/usr/rec.sh
Put this script there whith sudo nano /usr/bin/rec.sh
:
#!/bin/bash
while :
do
raiz=$(date +'/logger/%Y/%m/%d/')
saida=$(date +'/logger/%Y/%m/%d/%H%M%S.opus')
read min sec <<<$(date +'%M %S')
duracao=$((3600 - 10#$min*60 - 10#$sec))
duracao=60
echo "Starting new hour loging..."
echo "$saida"
echo "$duracao"
mkdir -p "$raiz"
vlc **your url here** --no-repeat --no-loop -I dummy --run-time="$duracao" --sout "#transcode{vcodec=none,acodec=opus,ab=64,channels=2,samplerate=48000,afilter=normvol,scodec=none}:std{access=file{no-overwrite},mux=ogg,dst='$saida'}" vlc://quit
echo "Done a hour logged!"
done
Make executable: sudo chmod +x /usr/bin/rec.sh
So, you need create a service Systemd for the script.
sudo nano /lib/systemd/system/rec.service
This sample help you:
[Unit]
Description=URL logger service
[Service]
ExecStart=/usr/bin/rec.sh
[Install]
WantedBy=multi-user.target
Reload systemd:
sudo systemctl daemon-reload
Enable and the service:
sudo systemctl enable shellscript.service
sudo systemctl start shellscript.service
check status:
sudo systemctl status shellscript.service
REMINDER: cvlc don't run as root by default. Here is the trick to do this:
sudo sed -i 's/geteuid/getppid/' /usr/bin/vlc
This service will record the url and transcode audio to OPUS in /logger directory, separated by YEAR / MONTH / DAY / HMS.opus (since record beggining). Each new file is started every hour o'clock.
I hope that help someone.
References:
https://tecadmin.net/run-shell-script-as-systemd-service/
and https://www.tecmint.com/run-vlc-media-player-as-root-in-linux/
Sorry my bad English.