Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Problem: Add startup script
#1
Hello everybody ! Happy new year :-)

I'm looking for some help:
I've a little script that i want to be ran at every moode audio startup: it import my palaylist and "convert" them for moode-audio.

i'v tried to add this at startup in this file:
/etc/rc.local

/home/pi/playlist_importer.sh > /dev/null 2>&1

but once i reboot Moode audio services dont start (MPC).

Code:
#!/bin/bash

echo "suppression des anciennes playlists"
    
    rm -f /home/pi/imported_playlists/*
    
    rm -f /var/lib/mpd/playlists/*

echo "importation des playlists"
    
    mkdir /home/pi/imported_playlists/
    sudo sshpass -p "password" sftp -o StrictHostKeyChecking=no "user@nas:/sharedfolders/playlists/* /home/pi/imported_playlists/"

echo "changement de repertoire"
    
    cd /home/pi/imported_playlists/

echo "renommage et conversion:"
    
    rename -f 's/.m3u8/.m3u/' *.m3u8

echo "Modification du chemin dans les playlists"
    
    sed -i 's#/airsonic#NAS#g; s#music#Musique#g' *.m3u

echo "playlists renommées - copie dans le dossier d'exploitation"

cp -f /home/pi/imported_playlists/* /var/lib/mpd/playlists/

echo "Mise a jour de la bibliotheque"

mpc update

Am i doing it wrong? Is there a way for this? Many thanks for your help:-)

Regards

Jonas
Reply
#2
@antipiot

I assume you've marked the playlist_importer.sh script as executable.

Probably you need to run your script in the background, e.g., in rc.local, add a trailing ampersand

Code:
/home/pi/playlist_importer.sh > /dev/null 2>&1 &
Regards,
Kent
Reply
#3
Hello!

Many thanks for your reply.
Looks like it's working now! :-)
Reply


Forum Jump: