Aptitude upgrade and crontab
|
Author |
Message |
|
|
Posted : Sat, 18 October 2008 00:17:17
Subject :
Aptitude upgrade and crontab
Hi. I've got an Ubuntu 8.04 machine running in a computer lab. I'm leaving the job soon, and no one else here knows how to run Linux (or has the time), so I want to set it up to automatically do safe upgrades.
Following an idea I found online, I added this entry to the root crontab file:
[code=xml]
0 1 * * * (aptitude -y update && aptitude -y safe-upgrade) >> /var/log/auto.update.log
[/code]
The idea is to use aptitude to update the package list, and then do a safe-upgrade. All the text output goes to a log file.
However, the packages are not actually being installed (although the update is successful). The same problem keeps coming up in the log file:
[code=xml]
dpkg: `ldconfig' not found on PATH.
dpkg: `start-stop-daemon' not found on PATH.
dpkg: `install-info' not found on PATH.
dpkg: `update-rc.d' not found on PATH.
dpkg: 4 expected program(s) not found on PATH.
NB: root's PATH should usually contain /usr/local/sbin, /usr/sbin and /sbin.
[/code]
All of these files are in the path of a bash root shell, but I'm not sure what shell crontab uses. What would be the easiest way to fix this? Can I just put 'bash' in front of my cron command? Or should I add path info to some config file?
|
|
|
|
proopnarine
|
Posted : Sat, 18 October 2008 04:09:31
Subject :
Aptitude upgrade and crontab
Perhaps the way to do this would be to include your upgrade commands in a bash script, and then have cron execute the script.
|
|
PerlCoder
|
Posted : Sat, 25 October 2008 01:45:34
Subject :
Re: Re: Aptitude upgrade and crontab
I tried this, and it didn't seem to work. Same log file results, and the packages are not being updated.
But then, all I really did was export to commands to a bash script and then tell cron to run the bash script. Now I've modified it a little bit, so the bash script looks like this:
[code=xml]
PATH=/usr/local/sbin:"${PATH}"
PATH=/usr/sbin:"${PATH}"
PATH=/sbin:"${PATH}"
(aptitude -y update && aptitude -y safe-upgrade) >> /var/log/auto.update.log
[/code]
Those are the paths that seem to be missing. I'll check the log tomorrow after the command has executed, and see if that worked. (Let me know if I messed up the syntax -- I don't do much shell scripting.)
[Modified by: PerlCoder on October 24, 2008 04:46 PM]
|
|
Peter
|
Posted : Sat, 25 October 2008 04:48:19
Subject :
Aptitude upgrade and crontab
Try adding those paths to the /etc/ld.so.conf file and then run ldconfig
|
|
alerque
|
Posted : Sat, 25 October 2008 21:04:01
Subject :
Re: Aptitude upgrade and crontab
[quote=PerlCoder][code=xml]0 1 * * * (aptitude -y update && aptitude -y safe-upgrade) >> /var/log/auto.update.log
[/code][/quote]
You can add those dirs to the path from the line in crontab and save writting a script as well.
[code]0 1 * * * PATH=$PATH:/usr/local/sbin:/usr/sbin:/sbin (aptitude -y update && aptitude -y safe-upgrade) >> /var/log/auto.update.log[/code]
|
|
PerlCoder
|
Posted : Sun, 26 October 2008 00:21:11
Subject :
Aptitude upgrade and crontab
Thanks for the suggestions, Peter and alerque. I checked today, and the adjustments I made to the bash script seem to have done the job. So I'm not going to bother changing the configuration, but I might do it differently in the future if the need arises again.
|