DON'T PANIC

Automatic Debian updating with Cron-apt

Posted on: November 4, 2010


Running “apt-get update” command always before installing packages is boring and is a waste of time. Cron-apt is a tool that is run by a cron job at regular intervals. By default it just updates the package list and downloads new packages without installing.
You can instruct it to run anything that you can do with apt-get or aptitude. It can optionally send mail to the system administrator on errors, log to syslog or a separate log file.

1. Install “cron-apt” package.
# apt-get install cron-apt

2. You should define frecuency to run apt periodically in /etc/cron.d/cron-apt. In my case, I have defined to run cron-apt

# vi /etc/cron.d/cron-apt


#
# Regular cron jobs for the cron-apt package
#
# All Sundays at 10:15 am.
15 10 * * 0 root test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt

If you don’t remember cron definition, below I have pasted a piece of text from Wikipedia:

Sintax
«#» is a comment.
At the moment to run it will define from next table:
Minutes: (0-59)
Hours: (0-23)
Days: (1-31)
Months: (1-12)
Day of week: (0-6), siendo 1=Monday, 2=Thursday,... 6=Saturday y 0=Sunday (Sometimes it could be 7=Sunday)
##########################################################
#minute (0-59), #
#| hour (0-23), #
#| | day of month (1-31), #
#| | | month (1-12), #
#| | | | day of week (0-6 which 0=Sunday) #
#| | | | | commands #
##########################################################
15 02 * * *

3. You can define which tool use in /etc/cron-apt/config. It would be: apt or aptitude.

# vi /etc/cron-apt/config


# APTCOMMAND=/usr/bin/apt-get
APTCOMMAND=/usr/bin/aptitude
# APTCOMMAND

4. In /etc/cron-apt/action.d/ you can define which actions do.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Advertisements

  • analialorenzatto: Buzz is just a host name for this example, it doesn't have any relation to the topic. Instead of being "Buzz", could be whatever name.
  • fridelain: >buzz What's the story behind this host name? Actully running buzz, once running buzz and upgraded many times since, or unrelated to debian naming
  • Pratik: Nice, but I would change it to include more directories. Like my .mozilla and .kde4 by using .{config,mozilla,kde4} instead of just .config .

Categories

%d bloggers like this: