update-motd

Dynamically update /etc/motd without relying on pam_motd
git clone git://git.danielmoch.com/update-motd.git
Log | Files | Refs

20-pacman (335B)


      1 #!/bin/sh
      2 out=/run/motd.pacman
      3 script=checkupdates
      4 
      5 if [ -f "$out" ]
      6 then
      7     echo
      8     echo "`cat "$out" | wc -l` packages can be updated"
      9     lastrun=`stat -c %Y "$out"` || lastrun=0
     10     expiration=`expr $lastrun + 3600`
     11 
     12     if [ `date +%s` -ge $expiration ]
     13     then
     14         $script > "$out" &
     15     fi
     16 else
     17     $script > "$out" &
     18 fi