update-motd

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

20-slackpkg (305B)


      1 #!/bin/sh
      2 out=/run/motd.slackpkg
      3 script=slackpkg\ check-updates
      4 
      5 if [ -f "$out" ]
      6 then
      7     echo
      8     cat $out
      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