Skip to content

Instantly share code, notes, and snippets.

@Wind4
Last active March 1, 2020 08:32
Show Gist options
  • Save Wind4/6ad83d2bea0d3e49a5e3 to your computer and use it in GitHub Desktop.
Save Wind4/6ad83d2bea0d3e49a5e3 to your computer and use it in GitHub Desktop.
#!/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
#!/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