View Full Version : How to keep my system up to date
Wizzard
May 3rd 2007, 06:20 PM
Hello.
I upgraded to Gutsy a few days after Feisty was released. I would like to keep my system up to date and I am tired of every day manual upgrade. I also disabled adept-updater, cause it was useless.
Any idea how to do it automatically?
Rog131
May 3rd 2007, 07:59 PM
i don't recommended but...
You could use cron (kcron)
About kcron:
KCron is an application for scheduling programs to run in the background.
It is a graphical user interface to cron, the UNIX system scheduler.
Press: Alt + F2 > kdesu kcron > Choose root and right click: program:
/usr/bin/apt-get update && /usr/bin/apt-get dist-upgrade
Choose daily + set time.
(or aptitude)
Or you could use anacron
Make script file
#!/bin/sh
/usr/bin/apt-get update && /usr/bin/apt-get dist-upgrade
Put it in the /etc/cron.daily/. anacron should execute these scripts once a day.
Set permissions:
udo chmod -v 755 /etc/cron.daily/script_name
From UNIX permissions and chmod tutorial
http://www.unixcities.com/howto/index3.html
So, 755 is a terse way to say 'I don't mind if other people read or run this file, but only I should be able to modify it' and 777 means 'everyone has full access to this file'
Wizzard
May 3rd 2007, 08:48 PM
Thank you veru much, I used anacron and put it to /etc/cron.hourly :)
Wizzard
May 3rd 2007, 09:02 PM
Just one more question, where can I found a log to control the upgrade activity? Cannot find it in /var/...
penguin.ch
May 4th 2007, 07:17 AM
a log to control the upgrade activity
/var/log/dpkg.log
Wizzard
May 7th 2007, 09:08 PM
Thank you all very much. But it seems that it does not work as it should.
I have this file in /etc/cron.hourly:
#!/bin/sh
apt-get update
apt-get dist-upgrade -y
apt-get -f install
dpkg --configure -a
apt-get clean
apt-get autoremove -y
But when I check /var/log/dpkg.log, there is nothing new in a lot of hours, even days. When I run that file manually, like this:
sudo /etc/cron.hourly/dist-upgrade
everything installs fine. where is the problem?
claydoh
May 8th 2007, 05:21 AM
Just be aware that at this stage, updates will frequently, often, and with regularity cause something to break :) so at least with manual daily updates, you can skip them if you catch any bugs/breakages before you install anything.
Wizzard
May 8th 2007, 07:35 AM
Yes, I know that, of course, and I am prepared for that. I have been running the development version quite a long time and I am prepared to fix any problem that can occur.
But I still do not know why the updates are not working fully automatically. Maybe one hour frequency is too low and sometimes the updates even cannot be finished when another update is released? Or should I modify some commands in that file or write full path or modify some parameters?
Rog131
May 8th 2007, 03:16 PM
From Anacron (wiki)
http://en.wikipedia.org/wiki/Anacron
Drawbacks compared to cron
Anacron can only run tasks once a day, (or less often such as weekly or monthly). In contrast, cron allows tasks to run as often as every minute...
So use cron. The easiest way: kcron.
If you wanto use cron/crontab. From Crontab:
http://doc.gwos.org/index.php/Crontab
A crontab is a simple text file that holds a list of commands that are to be run at specified times. These commands, and their related run times, are controlled by the cron daemon and are executed in the system's background. More information can be found by viewing the crontab's man page.
=> man cron / man crontab
Links
The KCron Handbook
http://docs.kde.org/stable/en/kdeadmin/kcron/index.html
Crontab
http://doc.gwos.org/index.php/Crontab
Wizzard
May 9th 2007, 09:27 PM
Ok, when I run kcron in root mode and want to add anything, it always crashes.
So I use cron. This is what I have in /etc/crontab:
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
and this is what I have in /etc/cron.hourly/dist-upgrade:
#!/bin/sh
apt-get update
apt-get dist-upgrade -y
dpkg --configure -a
apt-get clean
apt-get autoremove -y
I think that it does something, cause dpkg.log is sometimes modified, but it never installs everything. When I manually run dist-upgrade, it always works fine. Is there anything, that I do wrong?
Rog131
May 10th 2007, 08:40 AM
You could check /var/log/syslog (or syslog.0 ... )
example:
cat /var/log/syslog.0 | grep cron
snip
May 9 18:17:01 myhost /USR/SBIN/CRON[6178]: (root) CMD (run-parts --report /etc/cron.hourly)
May 9 19:17:01 myhost /USR/SBIN/CRON[6420]: (root) CMD (run-parts --report /etc/cron.hourly)
May 9 20:17:01 myhost /USR/SBIN/CRON[6659]: (root) CMD (run-parts --report /etc/cron.hourly)
snap
note
my cron.hourly is empty->only chekking.
Or (do you have mail ? In the konsole :~$ mail)
If not. Install mail (mailx)
from apt-cache show mailx
Description: A simple mail user agent
mailx is the traditional command-line-mode mail user agent.
Even if you don't use it it may be required by other programs.
From apt-cache show cron
Output from the commands is usually mailed to the system administrator
(or to the user in question); you should probably install a mail system
as well so that you can receive these messages.
So cron can send mail to you and tell what is wrong.
Wizzard
May 20th 2007, 03:30 PM
Thank you very much, finally it was not necessary. I moved that file to cron.daily and it works fine, one dist-upgrade a day is enough.
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.