I have a small script to start a fluidsynth server and then connect it to my midi device on my rasberry (OS is raspbian stretch lite).
echo "Starting" fluidsynth -is -a alsa --gain 3 /usr/share/sounds/sf2/Nice-Keys-B-Plus-JN1.4.sf2 & echo "Fluidsynth started" while true; do aconnect -o; if [[ $(aconnect -o ) = *FLUID* ]]; then break; fi; sleep 2; done aconnect 20:0 128:0 echo "Connected"
The aconnect -o outside of the condition is for debugging.
When I executed normally (./startup_fluid_synth.sh) it works fine: https://pastebin.com/kU0wDu3w
My crontab -e says:
@reboot /home/pi/startup_fluid_synth.sh >> /home/pi/fluid.log
Now when I reboo the pi, the scripts starts up, but the log clearly shows that the condition should be met, but isn't: https://pastebin.com/FnxMKBkF
Any idea why this could be?
Update: Error log shows:
/home/pi/startup_fluid_synth.sh: 4: /home/pi/startup_fluid_synth.sh: [[: not found
Is it possible that cron doesn't know the [[ ]] command somehow?