Summary: had tried to use crontab to run a script @ reboot. was using root (by running sudo) to do that. the problem that developed – I was also trying to run rclone to copy the files to onedrive, but rclone needed a config file that was only available to the pi user and didn’t see a config file for root.
ended up moving the @reboot crontab entry into the pi user’s crontab.
another option for starting something on boot : https://www.raspberrypi.org/documentation/linux/usage/rc-local.md
used crontab for latest project w/ timelapse camera
crontab troubleshooting: https://www.thegeekstuff.com/2012/07/crontab-log/
$ crontab -e 59 23 * * * /home/john/bin/backup.sh > /home/john/logs/backup.log 2>&1
In the above:
- > /home/john/logs/backup.log indicates that the standard output of the backup.sh script will be redirected to the backup.log file.
- 2>&1 indicates that the standard error (2>) is redirected to the same file descriptor that is pointed by standard output (&1).
- So, both standard output and error will be redirected to /home/john/logs/backup.log
how to use su (switch user) vs sudo
when using su pi -c need to put in quotes