/usr/sbin/drbl-swapfile is in drbl 2.6.15-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #!/bin/bash
# Author: Blake, Kuo-Lien Huang
# License: GPL
# Description: put/get the file to/from all DRBL clients,
# file utility for host(fuh)
#
# Modified by Steven Shiau <steven@nchc.org.tw> to be used in DRBL for RedHat
# Load DRBL setting and functions
DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
. $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
#
usage() {
echo "Start or stop the swapfile service in the DRBL client (This will make client to turn on/off the swap file when client boots)."
echo "Usage: $0 -s swapfile_size [start|stop]"
echo "-s, --size=SIZE: the maximum swap file SIZE (in MB)"
}
#
check_if_root
#
while [ $# -gt 0 ]; do
case "$1" in
-s|--size)
shift; maxswapsize="$1"
shift;;
-*) echo "${0}: ${1}: invalid option" >&2
usage >& 2
exit 2 ;;
*) break ;;
esac
done
# if maxswapsize is NOT specified, set the default value
[ -z "$maxswapsize" ] && maxswapsize=maxswapsize_default
#
switch=$1
case "$switch" in
start)
echo "Set the max swapfile size for each client as $maxswapsize MB."
for ihost in $drblroot/*; do
echo "maxswapsize=$maxswapsize" > \
$ihost/$SYSCONF_PATH/mkswapfile
done
drbl-client-service mkswapfile on
;;
stop)
for ihost in $drblroot/*; do
[ -f "$ihost/$SYSCONF_PATH/mkswapfile" ] && \
rm -f $ihost/$SYSCONF_PATH/mkswapfile
done
drbl-client-service mkswapfile off
;;
*)
usage
exit 1
esac
# Note, since drbl-client-service will run drbl-gen-ssi-files, so we do not have to run it here.
|