Starting a Blazor Server with Crontab on reboot on RPi

57 Views Asked by At

I have a Blazor Server running on my Raspberry-Pi and am trying to start it every reboot via crontab (as you may have figured). I have a script which starts the Blazor Server

#!/bin/bash
echo >> /home/.../log
echo >> /home/.../log
date >> /home/.../log
cd /var/.../bin/Release/net8.0/linux-arm/publish/
/var/.../bin/Release/net8.0/linux-arm/publish/published >> /home/.../log &
echo >> /home/.../log
echo >> /home/.../log

and I have a crontab service to start this script on reboot

@reboot sleep 120 && /home/.../start.sh

When I run the start.sh file noramlly, it executes just fine, and the Blazor Server starts. However, when the script is started via crontab -e (or sudo crontab -e), the Blazor Server doesn't start. the log file only has the date outputted.

Attempted Remedies:

"The network isn't ready when the script is run, and therefore doesn't run"

The crontab task has a 2 minute delay before the script runs; and I ssh in before it has run - the network is 100% ready when the script is run.

"Script is run using ~/ location instead of full path"

The script uses the full path (whether it be /home/... or /var/...).

"The script is not executable"

-rwxr-xr-x 1 ... ... 367 Month Day N:OW start.sh The crontab service is run as sudo; and the published Blazor Server file is also wrx for all users

0

There are 0 best solutions below