############################################################
-# If necessary, mount volatile database directory on tmpfs
-dbdir_tmpfs_start ()
-{
- if [ -z "$CTDB_DBDIR_TMPFS_OPTIONS" ] ; then
- return
- fi
-
- # Shortcut for readability
- _opts="$CTDB_DBDIR_TMPFS_OPTIONS"
-
- mkdir -p "$CTDB_DBDIR" || exit $?
-
- # If already mounted then remount, otherwise mount
- if findmnt -t tmpfs "$CTDB_DBDIR" >/dev/null ; then
- mount -t tmpfs -o "remount,$_opts" none "$CTDB_DBDIR" || \
- exit $?
- else
- mount -t tmpfs -o "$_opts" none "$CTDB_DBDIR" || exit $?
- fi
-}
-
-# If necessary, unmount volatile database tmpfs directory on exit
-dbdir_tmpfs_stop ()
-{
- if [ -z "$CTDB_DBDIR_TMPFS_OPTIONS" ] ; then
- return
- fi
-
- if [ -d "$CTDB_DBDIR" ] && findmnt -t tmpfs "$CTDB_DBDIR" >/dev/null ; then
- umount "$CTDB_DBDIR"
- fi
-}
-
# Only the nested function references its arguments
# shellcheck disable=SC2120
build_ctdb_options ()
start()
{
- dbdir_tmpfs_start
-
# build_ctdb_options() takes no arguments
# shellcheck disable=SC2119
build_ctdb_options
return 1
fi
- dbdir_tmpfs_stop
-
return 0
}
<para>
Defaults to <filename>/usr/local/var/lib/ctdb/volatile</filename>.
</para>
- <para>
- Apart from a DIRECTORY, this can take a special value of
- the form
- <option>tmpfs</option><optional>:<parameter>OPTIONS</parameter></optional>.
- OPTIONS is a comma-separated list of any permissible
- options to the tmpfs filesystem. The only pre-specified
- default is <option>mode=700</option>, which can
- overridden by specifying <option>mode</option> in
- OPTIONS. It probably makes sense to specify a maximum
- <option>size</option>.
- </para>
<para>
Corresponds to <option>--dbdir</option>.
</para>