Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marc-hughes/dfebccd90f9be324fe73eb30c39d0857 to your computer and use it in GitHub Desktop.
Save marc-hughes/dfebccd90f9be324fe73eb30c39d0857 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# /etc/rc.d/init.d/swap
#
# Daemon for swap
#
# chkconfig: - 05 99
# description: Enable swap space
### BEGIN INIT INFO
# Provides: swap
# Required-Start:
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop swap space
# Description: enables swap space
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions
prestart() {
echo "HI!"
}
start() {
echo "Unmount"
umount /dev/xvdb/
echo "Making swap"
mkswap /dev/xvdb
echo "Enabling swap"
swapon /dev/xvdb
swapon -s
}
stop() {
swapoff /dev/xvdb
}
restart() {
stop
start
}
reload() {
restart
}
force_reload() {
restart
}
rh_status() {
status -p $pidfile $prog
}
rh_status_q() {
rh_status >/dev/null 2>&1
}
check_for_cleanup() {
if [ -f ${pidfile} ]; then
/bin/ps -fp $(cat ${pidfile}) /dev/null || rm ${pidfile}
fi
}
case "" in
start)
;;
stop)
;;
restart)
;;
*)
echo $"Usage: {start|stop}"
exit 2
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment