Created
June 2, 2016 19:14
-
-
Save marc-hughes/dfebccd90f9be324fe73eb30c39d0857 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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