Rpi Crontab autostart - not working

Ive been skimming through previous posts and googling but ive yet to resolve why this simple startup script isnt working for me.

Is this line correct as its not executing my program?

  • my file has permissions

Copied this:

@reboot sleep 10 && cd /home/pi/openFrameworks/apps/myApps/<yourAppFile>/bin && ./<yourAppName>

Here’s mine:

@reboot sleep 10 && cd /home/pi/openFrameworks/apps/myApps/mvp_draft_6/bin && ./mvp_draft_6

Hi
If you’re running X window environment crontab won’t work.
You can see what’s discussed here, that should work:
https://www.raspberrypi.org/forums/viewtopic.php?t=193860

Or, less simple, the solution discussed here:
https://forum.openframeworks.cc/t/rpi4-buster-lite-of-0-11-0/35125/8

HTH

1 Like

Thanks for the info

Regards
Chris Courage

Hi @cuvner,

I personnally don’t use crontab, specially if you are just using it for a start up script.
My preference goes to a service ( it’s personnal so might not suit you, :slight_smile: ). It’s super simpler and you can get it to check when your app is down, so it auto restarts, as well as testing it in advance.

I don’t have a PI running right now, but the structur for an OF app should be similar to this:

[Unit]
Description= OF App start up service
After=network.target

[Service]
ExecStart=/usr/bin/sh testAppScript
WorkingDirectory=/home/pi/OF/apps/myApps/testApp/bin
StandardOutput=inherit
StandardError=inherit
Restart=always
User=pi

[Install]
WantedBy=multi-user.target

Hope this helps, find more infos in the link above, specially testing it.

Best,

P

1 Like

Nice solution @pierre_tardif00 . But i’m not sure it will work if you’re booting in a X Window environment, so this is especially true for Raspberry Pi4, where’s not super easy to launch OF app without X.
Did you test it in that case too?

Thanks

1 Like

Ah yeah haven’t tried sorry.
Let us know if you manage in the end.

Best,

P