source: src-sh/warden/scripts/backend/zfscronsnap.sh @ 0988d23

9.1-release9.2-releasereleng/10.0releng/10.0.1releng/10.0.2
Last change on this file since 0988d23 was 0988d23, checked in by Kris Moore <kris@…>, 17 months ago

Add my working directory for the new warden backend changes.

Includes patches from John Hixson (john@…) to change
how warden uses "nicknames" instead of IP addresses for jail
identification.

  • Property mode set to 100755
File size: 1.3 KB
Line 
1#!/bin/sh
2# ZFS functionality
3# Args $1 = jail-name
4# Args $2 = zfs directive
5#######################################################################
6
7# Source our functions
8PROGDIR="/usr/local/share/warden"
9
10# Source our variables
11. ${PROGDIR}/scripts/backend/functions.sh
12
13JAILNAME="${1}"
14ACTION="${2}"
15
16if [ -z "${JAILNAME}" ]
17then
18  echo "ERROR: No jail specified to start!"
19  exit 5
20fi
21
22if [ -z "${JDIR}" ]
23then
24  echo "ERROR: JDIR is unset!!!!"
25  exit 5
26fi
27
28JAILDIR="${JDIR}/${JAILNAME}"
29
30if [ ! -d "${JAILDIR}" ]
31then
32  echo "ERROR: No jail located at ${JAILDIR}"
33  exit 5
34fi
35
36set_warden_metadir
37
38if [ "$ACTION" = "start" ] ; then
39  isDirZFS "${JAILDIR}" "1"
40  if [ $? -ne 0 ] ; then printerror "Not a ZFS volume: ${1}" ; fi
41
42  TIME="${3}"
43  COUNT="${4}"
44  case $TIME in
45  daily|hourly) ;;
46        *) echo "ERROR: Invalid frequency specified!" ; exit 5 ;;
47  esac
48  if [ ! $(is_num "$COUNT") ] ; then
49     echo "ERROR: Invalid count specified!" ; exit 5
50  fi
51
52  enable_cron
53  echo "${TIME}" >${JMETADIR}/cron
54  echo "${COUNT}" >${JMETADIR}/cron-keep
55  echo "Snapshot frequency set: $TIME"
56  echo "Snapshot days to keep set: $COUNT"
57  exit 0
58fi
59
60if [ "$ACTION" = "stop" ] ; then
61   rm ${JMETADIR}/cron 2>/dev/null >/dev/null
62   rm ${JMETADIR}/cron-keep 2>/dev/null >/dev/null
63   exit 0
64fi
65
Note: See TracBrowser for help on using the repository browser.