Difference between revisions of "Update packages from crontab"

From ArchWiki
Jump to: navigation, search
(Created page with "== Do not try this at home! == {{Warning|'''Doing automatic updates from cron is strongly discouraged. It is likely to leave your machine in a broken and unbootable state.''' ...")
 
(automatic style fixes + categorize like Cron)
Line 1: Line 1:
 +
[[Category:Daemons and system services (English)]]
 +
{{i18n|Update packages from crontab}}
 +
 
== Do not try this at home! ==
 
== Do not try this at home! ==
 
{{Warning|'''Doing automatic updates from cron is strongly discouraged. It is likely to leave your machine in a broken and unbootable state.'''
 
{{Warning|'''Doing automatic updates from cron is strongly discouraged. It is likely to leave your machine in a broken and unbootable state.'''
Line 7: Line 10:
 
# First, you (obviously!) need to [[cron|install cron itself]]. Do that first.
 
# First, you (obviously!) need to [[cron|install cron itself]]. Do that first.
 
# It is highly recommended to also install a mail transfer agent, such as [[Postfix]], to send you notifications if pacman fails.
 
# It is highly recommended to also install a mail transfer agent, such as [[Postfix]], to send you notifications if pacman fails.
# Run as root: <code>crontab -e</code>
+
# Run as root: {{ic|crontab -e}}
 
# Copy-paste this to your crontab:
 
# Copy-paste this to your crontab:
  
<pre>
+
{{bc|<nowiki>
 
MAILTO=your@email
 
MAILTO=your@email
 
LOGFILE=/var/log/cron-pacman.log
 
LOGFILE=/var/log/cron-pacman.log
Line 23: Line 26:
 
#min hr  dom mon dow command
 
#min hr  dom mon dow command
 
00  13  *  *  *  . /etc/profile && (echo; date; yes |pacman -Syuq) &>>$LOGFILE || (echo 'pacman failed!'; tail $LOGFILE; false)
 
00  13  *  *  *  . /etc/profile && (echo; date; yes |pacman -Syuq) &>>$LOGFILE || (echo 'pacman failed!'; tail $LOGFILE; false)
</pre>
+
</nowiki>}}
  
 
If you want to automatically reboot your computer upon a successful upgrade, append '&& reboot' to the above line.
 
If you want to automatically reboot your computer upon a successful upgrade, append '&& reboot' to the above line.

Revision as of 13:12, 21 March 2012

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.


Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어


External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Do not try this at home!

Warning: Doing automatic updates from cron is strongly discouraged. It is likely to leave your machine in a broken and unbootable state. If this breaks your machine, do not hold anyone but yourself responsible. You have been warned.

So, proceed only if you have balls of steel or you were intending to crash your machine anyway. If so, you might as well do it the "right way".

  1. First, you (obviously!) need to install cron itself. Do that first.
  2. It is highly recommended to also install a mail transfer agent, such as Postfix, to send you notifications if pacman fails.
  3. Run as root: crontab -e
  4. Copy-paste this to your crontab:
MAILTO=your@email
LOGFILE=/var/log/cron-pacman.log

# 1. minute (0-59)
# |   2. hour (0-23)
# |   |   3. day of month (1-31)
# |   |   |   4. month (1-12)
# |   |   |   |   5. day of week (0-7: 0 or 7 is Sun, or use names)
# |   |   |   |   |   6. commandline
# |   |   |   |   |   |
#min hr  dom mon dow command
00   13   *   *   *  . /etc/profile && (echo; date; yes |pacman -Syuq) &>>$LOGFILE || (echo 'pacman failed!'; tail $LOGFILE; false)

If you want to automatically reboot your computer upon a successful upgrade, append '&& reboot' to the above line.