From 9e0f8ac82d04a658f7f07b0f7cf2044c4e3e4e02 Mon Sep 17 00:00:00 2001 From: Patrick Darley Date: Mon, 28 Sep 2015 10:52:14 +0000 Subject: Some init scripts to be used to serve images and artifacts when the aws is started. Needs some sort of setup script to put them in place. Also needs some sort of ybd that isnt in pdars homedir --- init_scripts/artifact_server | 42 ++++++++++++++++++++++++++++++++++++++++++ init_scripts/img_server | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100755 init_scripts/artifact_server create mode 100755 init_scripts/img_server diff --git a/init_scripts/artifact_server b/init_scripts/artifact_server new file mode 100755 index 0000000..cfe2630 --- /dev/null +++ b/init_scripts/artifact_server @@ -0,0 +1,42 @@ +#!/bin/sh +# +# description: a server for the artifact cache +# chkconfig: 2345 90 10 + +# Make init function library available +. /etc/init.d/functions + +# FIXME The kbas dir should be updated to some `/home/ciat` type loction +# mess up the use of ybd for building which gets replaced all the time +kbas_dir=/home/patrickdarley/ybd +logfile="$kbas_dir"/kbas.log + +# Start the service +start() { + echo "Starting kbas artifact server" + sudo "$kbas_dir"/kbas.py > "$logfile" & +} +# Stop the service +stop() { + echo "Stopping kbas" + # FIXME, Err, this is probably not the best way to do this + sudo kill -9 `ps aux|awk '/[k]bas.py/ {print $2}'` +} + +### Main logic ### +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload|condrestart) + stop + start + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|status}" + exit 1 +esac +exit 0 diff --git a/init_scripts/img_server b/init_scripts/img_server new file mode 100755 index 0000000..de09930 --- /dev/null +++ b/init_scripts/img_server @@ -0,0 +1,40 @@ +#!/bin/sh +# +# description: a server for the image archive +# chkconfig: 2345 90 50 +# +# Make init function library available +. /etc/init.d/functions + +prog=SimpleHTTPServer + +# Start the service +start() { + echo "Starting $prog" + cd /archive/images + /usr/bin/python -m SimpleHTTPServer & +} +# Stop the service +stop() { + echo "Stopping $prog" + pid=`ps aux|awk '/[S]impleHTTPServer/ {print $2}'` + kill "$pid" +} + +### Main logic ### +case "$1" in + start) + start + ;; + stop) + stop + ;; + restart|reload|condrestart) + stop + start + ;; + *) + echo $"Usage: $0 {start|stop|restart|reload|status}" + exit 1 +esac +exit 0 -- cgit v1.2.1