0

I have been trying to get my mono form application to autostart with the GUI and I have tried lots of methods shown on other threads but it just won't work.

I manually run a .sh script by double clicking on the file to run my mono application which has this command:

sudo mono /home/pi/Test/monoApp.exe

I tried xinitrc, LXDE-pi, crontab, rc.local but they didn't work.

  • If it works from the command line but not from crontab that indicates a path problem. Use sudo which mono to find the full path to mono and try using that full path in your scripts or crontab. – joan Jul 14 '17 at 10:47
  • I changed the mono to /usr/bin/mono but nothing changed. The .sh file launches the application both with mono and /usr/bin/mono when double clicking. Can I launch the mono application by a python script? – Theoden Jul 14 '17 at 11:01
4

First: create a start.sh file like this:

cd /home/pi/Test
mono monoApp.exe

Second: make this file executable

chmod +x start.sh

Third: setup crontab on startup

crontab -e

and add reboot file:

@reboot /home/pi/start.sh

on bottom, save and exit, reboot

  • Thanks for the info, I did as you told but nothing happens when I reboot the system. – Theoden Jul 14 '17 at 10:41
  • Try to check if your file are run on startup, i.e. insert mkdir something on top and reboot, so you can find this dir, if you don't find it the problem is on crontab that cannot run your file, if you find it, the problem is inside the file – Francesco Gusmeroli Jul 14 '17 at 11:21
  • mkdir command works both from the script and from the crontab @reboot. I think the problem is really about the mono. Thank you for your extensive help and suggestions. – Theoden Jul 14 '17 at 11:41
  • Do not forget to add #!/bin/bash on top of your start.sh script – Tono Nam May 14 '18 at 22:26

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.