You are not logged in.

#1 2005-08-09 23:56:10

shadowhand
Member
From: MN, USA
Registered: 2004-02-19
Posts: 1,142
Website

cron jobs [pacman + ntp]

I just made this little thing to sync and update my computer with pacman and thought I would share it.

#!/bin/sh

# Check if eth0 is up, if so, sync and update
# all packages without confirmation
if /sbin/ifconfig | grep eth0 &> /dev/null ; then
  /usr/bin/pacman -Syu --noconfirm
fi

And I also made this ntp script to sync my hwclock to atomic time.

#!/bin/sh

# Check if ntp is installed and sync
# if eth0 is up
# 
# You can find a list of servers at:
# http://ntp.isc.org/bin/view/Servers/WebHome
if [ -x /usr/bin/ntpdate ]; then
  if ifconfig | grep eth0 &> /dev/null ; then
    ntpdate 128.101.101.101 &> /dev/null
  fi
fi

Obviously, if you use dialup, you will want to change the "grep eth0" to "grep ppp0" (or whatever the proper name would be, I'm not a dialup user).


·¬»· i am shadowhand, powered by webfaction

Offline

#2 2005-09-10 08:13:35

Snowman
Developer/Forum Fellow
From: Montreal, Canada
Registered: 2004-08-20
Posts: 5,212

Re: cron jobs [pacman + ntp]

It is not recommended to blindly upgrade your system with a cron job.  Sometime some extra steps needs to be done before/after an upgrade (like running lilo after kernel upgrade, etc).  Plus you will miss the post-install info.  If you want to automate something, I would suggest using:
/usr/bin/pacman -Syw --noconfirm
instead.  It will update the db and download the packages but won't install/upgrade them.  That way, you'll be aware of which packages are being upgraded and be able to keep an eye on the upgrade process.

Offline

#3 2005-09-10 14:25:17

T-Dawg
Forum Fellow
From: Charlotte, NC
Registered: 2005-01-29
Posts: 2,736

Re: cron jobs [pacman + ntp]

what if talk of a certain package circulates the forums as breaking something and your automatic update installed it before you could ignore it? If you didn't have the old in cache to downgrade, you'd have to spend a bunch of time searching around for it, if it could be found at all.
What if you ignore a package but need to know when the next version is available?
Sure, you could redirect the output of the upgrade process into a file for the latter situation but what about the first?
Also, what if you use lilo, had a kernel upgrade and rebooted without running lilo simply because you forgot to check the logs? So if having to check the logs to keep on top of things with auto-updates is required, how much harder then would it be to run pacman -Syu manually?

All of these issues can be worked around but I think it introduces more complexity and danger into the system then what its worth.

Offline

Board footer

Powered by FluxBB