Changeset cb8f638


Ignore:
Timestamp:
08/16/13 07:17:14 (11 months ago)
Author:
Kris Moore <kris@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1, releng/10.0.2
Children:
1d1b425, 5fd031d
Parents:
176289d
Message:

Add "lpreserver status" command, which will show last snapshot / replication for all datasets

Location:
src-sh/lpreserver
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src-sh/lpreserver/backend/functions.sh

    r0c5977f rcb8f638  
    349349  fi 
    350350} 
     351 
     352listStatus() { 
     353 
     354  for i in `grep "${PROGDIR}/backend/runsnap.sh" /etc/crontab | awk '{print $8}'` 
     355  do 
     356    echo -e "DATASET - SNAPSHOT - REPLICATION" 
     357    echo "------------------------------------------" 
     358 
     359    lastSEND=`zfs get -r backup:lpreserver ${i} | grep LATEST | awk '{$1=$1}1' OFS=" " | tail -1 | cut -d '@' -f 2 | cut -d ' ' -f 1` 
     360    lastSNAP=`zfs list -t snapshot -d 1 -H ${i} | tail -1 | awk '{$1=$1}1' OFS=" " | cut -d '@' -f 2 | cut -d ' ' -f 1` 
     361 
     362    if [ -z "$lastSEND" ] ; then lastSEND="NONE"; fi 
     363    if [ -z "$lastSNAP" ] ; then lastSNAP="NONE"; fi 
     364 
     365    echo "$i - $lastSNAP - $lastSEND" 
     366  done 
     367} 
  • src-sh/lpreserver/lpreserver

    r4f0d211 rcb8f638  
    5151 revertsnap - Revert zpool/dataset to a snapshot 
    5252  replicate - Enable / Disable ZFS replication to a remote system 
     53     status - List datasets, along with last snapshot / replication date  
    5354     rmsnap - Remove a snapshot 
    5455__EOF__ 
     
    177178" 
    178179}; 
     180 
     181help_status() 
     182{ 
     183 title 
     184 echo "Help status 
     185 
     186List monitored dataset's last snapshot and replication 
     187 
     188Usage: 
     189 
     190  lpreserver status 
     191 
     192" 
     193}; 
     194 
    179195 
    180196help_listsnap() 
     
    309325           cronsnap) help_cronsnap ;; 
    310326           rmsnap) help_rmsnap ;; 
     327           status) help_status ;; 
    311328           *) help_main ;; 
    312329         esac  ;; 
     
    379396         ${PROGDIR}/backend/zfsrmsnap.sh "${DATASET}" "${SNAP}" 
    380397         ;; 
     398    status) listStatus 
     399         ;; 
    381400 replicate) require_root 
    382401            shift 
Note: See TracChangeset for help on using the changeset viewer.