I have been reading several posts regarding automated scripting using the famous crontab. I haven't been successful yet and need someone to kindly point me in the right direction. Attached are my two statics.
or even at all.tpylkko wrote:are you sure you want to run rpi-update automatically?
Code: Select all
# m h dom mon dow command
6 15 5 * * sh /home/pi/scripts/update.sh
Code: Select all
# m h dom mon dow command
6 15 5 * * sh /home/pi/scripts/update.sh > /home/pi/logs/update.log 2>&1
I would prefer not to have to manually update if possible and always updating on bootup, I believe, is not necessary. Crontab or anacron (not sure what this is yet and will check) is the solution.tpylkko wrote:how have you verified that this does not work? are you aware that the pi has to be powered on and running at the time specified in cron? if this is not possible, you should look at anacron. is the script matked as executable? are you sure you want to run rpi-update automatically?
I am using "crontab -e" for user pi. I don't believe I should sudo because of elevated status. Am I correct?rpdom wrote:or even at all.tpylkko wrote:are you sure you want to run rpi-update automatically?
If you are having problems with getting a cron job to work, you should probably no run rpi-update at all as it may leave your system in a state where you need a bit of experience to fix it.
About your crontab entryYou've set that to run at 3:06pm on the 5th day of every month. Is that what you intended?Code: Select all
# m h dom mon dow command 6 15 5 * * sh /home/pi/scripts/update.sh
It should work though. You could always add some debugging options, like thisThat will send any output from the script to the file /home/pi/logs/update.log so you can check for errors. (You'll need to create a logs directory if you haven't already got one.Code: Select all
# m h dom mon dow command 6 15 5 * * sh /home/pi/scripts/update.sh > /home/pi/logs/update.log 2>&1
Just one last question. Are you using "crontab -e" to edit the file, or "sudo rcontab -e"?
not if the the sudo then requires a password [which I know in default situations it does not now] however that may change or the user may have changed it.Joe Schmoe wrote:Isn't it a lot easier (and better advice to be giving newbies) to put the 'sudo' in the cron job i....
I agree with all of your (theoretical) points.not if the the sudo then requires a password...
Agreed, but then again, Windows these days is all like that....though it has to be said again
automated upgrades are not usually the best...