Linux.com

Author Message
Joined: Jun 30, 2008
Posts: 148
Other Topics
Posted Oct 18, 2008 at 12:17:17 AM
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?

PerlCoder (http://indicium.us)

Back to top Profile Email Website
proopnarine

Joined Apr 03, 2008
Posts: 590
Location:San Francisco

Other Topics
Posted: Oct 18, 2008 4:09:31 AM
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.

Take the red pill

Climate Change Blog

Food Weblog

Back to top Profile Email Website
PerlCoder
Joined Jun 30, 2008
Posts: 148

Other Topics
Posted: Oct 25, 2008 1:45:34 AM
Subject: 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]

PerlCoder (http://indicium.us)

Back to top Profile Email Website
Peter
Joined May 16, 2008
Posts: 43
Location:Mexico

Other Topics
Posted: Oct 25, 2008 4:48:19 AM
Subject: Aptitude upgrade and crontab
Try adding those paths to the /etc/ld.so.conf file and then run ldconfig
Back to top Profile Email Website
alerque
Joined Jun 20, 2007
Posts: 2

Other Topics
Posted: Oct 25, 2008 9:04:01 PM
Subject: 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]
Back to top Profile Email Website ICQ MSN Yahoo! AOL Instant Messenger
PerlCoder
Joined Jun 30, 2008
Posts: 148

Other Topics
Posted: Oct 26, 2008 12:21:11 AM
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.

PerlCoder (http://indicium.us)

Back to top Profile Email Website
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya