Quote:
I ran the commands and it's slightly different.
|
In linux, or indeed any OS, "slightly different" can mean a BIG difference.
You need to think about
why they are "slightly different" (and read the manpages for
sudo and
crontab) and also learn more about how $PATH is set under different circumstances. This is very basic stuff if you want to write scripts to automate things (linux is excellent at this sort of thing).
It may not be a good idea to run
aptitude updates as a cron job.
There are several reasons but here are two:
- You might not want to apply an update
- The update may stall at some point asking, for example, "Do you really want to do this? There's a nasty conflict with version numbers. What do you want to do...?
But, when run as a cron job, there is no terminal to display this output on. So you will be none the wiser, and come back here complaining that "linux isn't working anymore" and you'll have forgotten about running aptitude as a cronjob, and we'll never guess, and you'll be cross.
My 8.04.1 kubuntu install puts an "Updates available" on my panel when updates are ready. Then I can click it, and see what is going to happen, and then decide for myself what to do about it. I much prefer this to linux deciding "automagically" to mess things up completely (like windows did when I used to use it).
If you
really want to use cron to run this as a cron job, don't put the aptitude command in the crontab, have the crontab call a script instead.
In that script, make sure the $PATH is set correctly, then let it fire up aptitude, and
log any error messages to a file that you will of course, remember to check when it all goes horribly wrong.