0

I am looking for a simple way to start a simple .exe program on every bootup using rc.local (unless there's an easier way).

Currently, the executable program I want to run is located in: /home/pi/boot and is running properly using the sudo mono command.

I am trying to make this run at boot in the rc.local and I currently just have:

sudo /home/pi/boot/EXENAME.exe

of course I have the #!/bin/sh -e at the top of the file but not sure exactly how I should get this working.

  • Do not use sudo in rc.local or anything it starts unless you've intentionally changed UID. It's already running root. Throwing in sudo cannot do anything good. See also: raspberrypi.stackexchange.com/questions/40493/… – goldilocks Apr 1 '16 at 14:34
  • Are you able to successfully run your exe from an interactive command shell? If so, what command line do you type to make it run? (IE. mono /home/pi/boot/EXENAME.exe) – pierce.jason Apr 1 '16 at 20:16
1

.exe files will only run under mono. Prefix your file location with 'mono' in your script and it should work.

  • Thanks very much for you response. I now used: #!/bin/sh -e mono /home/pi/boot/EXENAME.exe exit 0 Which did not work. I also tried sudo mono which didn't work I must be doing something wrong. I also made rc.local executable by doing a "$ ls -l /etc/rc.local" but again nothing worked yet. – Sharks Apr 1 '16 at 16:07
0

You should not be using rc.local assuming you are running a recent Raspbian which uses systemd. systemd will attempt to convert a well structured sysV script to a service, so it should still work.

An alternative for this case is to use cron.

You add commands to crontab by editing with crontab -e. E.g. I have @reboot sudo python /home/pi/shutdown_daemon.py in mine to run a program at boot.

There is a good tutorial at https://www.raspberrypi.org/documentation/linux/usage/cron.md

NOTE The first thing you should do (with ANY method) is run the program manually to ensure it actually works and the correct syntax.

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.