-
-
Save xdtianyu/cd3320424352b2e17b085b725c1ea7f4 to your computer and use it in GitHub Desktop.
curl -sL https://gist.github.com/Wind4/6ad83d2bea0d3e49a5e3/raw/86000b8762b75b47bfb85b07c1e440898a4f4e4b/vlmcsd.sh | bash
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/bash | |
# | |
# vlmcsd - this script starts and stops the vlmcsd-server daemon | |
# | |
# Run level information: | |
# chkconfig: 2345 99 99 | |
# description: KMS Emulator in C | |
# processname: vlmcsd | |
# Source function library | |
source /etc/init.d/functions | |
# Check that networking is up. | |
# | |
[ ${NETWORKING} ="yes" ] || exit 0 | |
# Daemon | |
NAME=vlmcsd-server | |
DAEMON=/usr/bin/vlmcsd | |
# Path to the lock file. | |
# | |
LOCK_FILE=/var/lock/subsys/vlmcsd | |
# Path to the pid file. | |
# | |
PID_FILE=/var/run/vlmcsd.pid | |
#======================================================================= | |
RETVAL=0 | |
# Start vlmcsd as daemon. | |
# | |
start() { | |
if [ -e $LOCK_FILE ];then | |
echo "$NAME is already running!" | |
exit 1 | |
fi | |
echo -n $"Starting ${NAME}: " | |
daemon $DAEMON -p $PID_FILE | |
RETVAL=$? | |
echo | |
[ $RETVAL -eq 0 ] && touch $LOCK_FILE | |
return $RETVAL | |
} | |
# Stop vlmcsd | |
# | |
stop() { | |
echo -n $"Shutting down ${NAME}: " | |
killproc -p $PID_FILE | |
RETVAL=$? | |
[ $RETVAL -eq 0 ] | |
rm -f $PID_FILE | |
rm -f $LOCK_FILE | |
echo | |
return $RETVAL | |
} | |
# Restart vlmcsd | |
# | |
restart() { | |
stop | |
start | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
restart | |
;; | |
*) | |
echo $"Usage: $0 {start|stop|restart}" | |
RETVAL=1 | |
esac | |
exit $RETVAL |
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/bash | |
# | |
# Author: Wind4 ([email protected]) | |
# | |
# Installs a vlmcsd server for CentOS 6/7 | |
# declare | |
WORK_DIR=/tmp/vlmcsd | |
VL_VERSION="779" | |
# user settings | |
read -p "Please input vlmcsd SVN version (${VL_VERSION}): " input | |
VL_VERSION=${input:-$VL_VERSION} | |
# switch work dir | |
mkdir -p ${WORK_DIR} | |
cd ${WORK_DIR} | |
# download | |
yum install wget -y | |
wget http://files.crsoo.com/packages/vlmcsd/svn${VL_VERSION}/binaries/Linux/intel/static/vlmcsd-x64-musl-static -O ./vlmcsd.run || { echo "Download failed"; exit 1; } | |
wget https://gist.github.com/Wind4/6ad83d2bea0d3e49a5e3/raw/c011bb4c5992602bbbfe743e57ded0d6869beb88/vlmcsd -O ./vlmcsd.init || { echo "Download failed"; exit 1; } | |
# config | |
cp ./vlmcsd.run //usr/bin/vlmcsd | |
chmod +x /usr/bin/vlmcsd | |
cp ./vlmcsd.init /etc/init.d/vlmcsd | |
chmod +x /etc/init.d/vlmcsd | |
chkconfig --add vlmcsd | |
service vlmcsd start | |
# clean up | |
rm -rf ${WORKDIR} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment