My goal was to make my Pi create its own WiFi on start so that I can connect to it wirelessly.
I have succeeded by creating a crontab entry (using sudo crontab -e):
@reboot /path/to/create_ap.sh &
where create_ap.sh is a script launching create_ap:
#!/bin/bash
sudo create_ap -n wlan0 MySSID MyPass --daemon
However, I've failed to do this without an additional script: both
@reboot create_ap -n wlan0 MySSID MyPass --daemon
and
@reboot create_ap -n wlan0 MySSID MyPass --daemon &
didn't work as expected (I've also tried to add full path, /usr/bin/create_ap like suggested in comments but that didn't help).
So does crontab allow parameters after the command? (I suspect that only @reboot create_ap bit works in practice, but failed to google that) Or is there some other problem with these lines in crontab and I can adjust them so that an external script is not needed?
create_apin your crontab work? (I believe the path is/usr/bin/create_ap). Does your crontab change thePATHvariable in any other way? – Aurora0001 Jan 01 '18 at 10:56which create_apsays/usb/bin/create_apand I've tried full path in crontab but that didn't help – YakovL Jan 01 '18 at 17:51crontab -e) one difference is that the command kicks off as your user, whereas your script includessudoto execute the command as root. This should go into a system crontab to execute as root on startup. – bobstro Jan 02 '18 at 14:38sudo crontab -eso that's root crontab, I guess. Will add this to the question – YakovL Jan 02 '18 at 18:44create_apscript in the non-working entries. Try prepending a path tocreate_ap. Check logs or email for errors. – bobstro Jan 02 '18 at 20:06/usr/bin/create_aplike suggested in comments but that didn't help"). Though, I'm not sure what logs to check and how to check email yet. – YakovL Jan 02 '18 at 23:22cronjob. I'd suggest you delete this question, and start over. – Seamus Sep 07 '20 at 17:37cronjob – please elaborate, this didn't happen by itself in my case. – YakovL Sep 08 '20 at 10:15cronon an example that's actually easier solved withoutcron. That may be true, I can't really say what I've googled back than and why I triedcronand not some other method. However, the question is aboutcronand not about setting a wireless connection because I wanted to know more aboutcron. I've searched a bit but haven't found why what I tried didn't work, so I've asked here. No, I don't have another, more pressing issue regardingcronat hand to rewrite this question, sorry. – YakovL Sep 09 '20 at 13:50cronthere are 1,003 Q&A here on RPi SE. You might also look atsystemdfor starting things. An entire world of help is out there - all for the cost of a search. – Seamus Sep 09 '20 at 20:26