0

I'm trying to get the /etc/rc.local file to run my dotnet core app on startup. These commands work fine if I just manually type into the terminal.

I tried to setup logging on the rc.local to see whats happening but I can't find the file. Also I need to send as two separate commands, if I don't cd into directory first it doesn't work (manually anyway).

sleep 10

exec 2> /tmp/rc.local.log      # send stderr from rc.local to a log file
exec 1>&2                      # send stdout to the same log file
set -x                         # tell sh to display commands before execution

cd /home/pi/Desktop/Pisurvey
sudo dotnet pi-survey.dll

exit 0
1

I have worked it out, I had an iptables command before it that was breaking it. What I didn't know beforehand is you can run the rc.local file manually in terminal and it will tell you if there are any errors.

0

You do not need sudo if you are auto running /etc/rc.local as it is run as root.

The file being run as root is probably causing the problem.

The root user has different default paths. It is likely that dotnet is not in root's path. Use the full path to dotnet within /etc/rc.local.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.