Permalink
Browse files

Add in default cron jobs and init scripts

  • Loading branch information...
1 parent b50de19 commit 0bf2759a097bcd379c01223610b3cec35ad02218 @nwgh nwgh committed Sep 19, 2012
@@ -0,0 +1,4 @@
+MAILTO=hurley@mozilla.com
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+HOME=/home/hurley
+0 10 * * * hurley python $HOME/srhome/stoneridge/srrun.py $HOME/srhome/stoneridge/stoneridge_cronjob.py --config $HOME/srhome/stoneridge.ini
@@ -0,0 +1,5 @@
+MAILTO=hurley@mozilla.com
+PATH=/bin:/sbin:/usr/bin:/usr/sbin
+HOME=/home/hurley
+0 8 * * * hurley python $HOME/srhome/stoneridge/srrun.py $HOME/srhome/stoneridge/stoneridge_cloner.py --config $HOME/srhome/stoneridge.ini
+0 13 * * * root python $HOME/srhome/stoneridge/srrun.py $HOME/srhome/stoneridge/stoneridge_reporter.py --config $HOME/srhome/stoneridge.ini
@@ -0,0 +1,50 @@
+#!/bin/bash
+#
+# stoneridge_client Stone Ridge client setup
+#
+# chkconfig: 2345 98 09
+# description: stoneridge_client is responsible for running tests
+
+### BEGIN INIT INFO
+# Provides: stoneridge client
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs $network
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start and stop stoneridge client
+# Description: stoneridge client runs tests
+### END INIT INFO
+
+### BEGIN CONFIGURATION SECTION
+SRHOME=/home/hurley/srhome
+MYIP=172.16.1.1
+### END CONFIGURATION SECTION
+
+PIDFILE=$SRHOME/srdns.pid
+LOGFILE=$SRHOME/srdns.log
+
+start() {
+ ip addr add $MYIP/12 dev eth1
+ python $SRHOME/stoneridge/srrun.py $SRHOME/stoneridge/srdns.py --pidfile $PIDFILE --log $LOGFILE
+}
+
+stop() {
+ kill $(cat $PIDFILE)
+ ip addr del $MYIP/12 dev eth1
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart|force-reload|reload)
+ stop
+ start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload|force-reload}"
+ exit 2
+esac
@@ -0,0 +1,49 @@
+#!/bin/bash
+#
+# stoneridge_master Stone Ridge master setup
+#
+# chkconfig: 2345 98 09
+# description: stoneridge_master is responsible for serving builds and \
+# uploading results to the graph server
+
+### BEGIN INIT INFO
+# Provides: stoneridge master
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs $network
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start and stop stoneridge master
+# Description: stoneridge serves builds and uploads results
+### END INIT INFO
+
+### BEGIN CONFIGURATION SECTION
+SRHOME=/home/hurley/srhome
+### END CONFIGURATION SECTION
+
+PIDFILE=$SRHOME/stoneridge_server.pid
+LOGFILE=$SRHOME/stoneridge_server.log
+CONFFILE=$SRHOME/stoneridge.ini
+
+start() {
+ python $SRHOME/stoneridge/srrun.py $SRHOME/stoneridge/stoneridge_server.py --pidfile $PIDFILE --log $LOGFILE --config $CONFFILE
+}
+
+stop() {
+ kill $(cat $PIDFILE)
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart|force-reload|reload)
+ stop
+ start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload|force-reload}"
+ exit 2
+esac
@@ -0,0 +1,73 @@
+#!/bin/bash
+#
+# stoneridge_server Stone Ridge server setup
+#
+# chkconfig: 2345 98 09
+# description: stoneridge_server is responsible for serving resources and \
+# maintaining network conditions
+# processname: httpd
+# pidfile:
+# config: /home/hurley/srhome/conf/httpd.conf
+
+### BEGIN INIT INFO
+# Provides: stoneridge server
+# Required-Start: $local_fs $network
+# Required-Stop: $local_fs $network
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: Start and stop stoneridge server
+# Description: stoneridge server sets network conditions and serves resources
+### END INIT INFO
+
+### BEGIN CONFIGURATION SECTION
+SRHOME=/home/hurley/srhome
+MAINIP=172.17.0.1
+RATE=10mbit
+MAXBURST=10240
+LIMIT=30720
+LATENCY=90ms
+JITTER=
+CORRELATION=
+### END CONFIGURATION SECTION
+
+PIDFILE=$SRHOME/srnamed.pid
+LOGFILE=$SRHOME/srnamed.log
+
+start() {
+ # Setup eth1 to have an address
+ ip addr add $MAINIP/12 dev eth1
+ # Setup our network conditions on eth1
+ tc qdisc add dev eth1 root handle 1:0 tbf rate $RATE maxburst $MAXBURST limit $LIMIT
+ tc qdisc add dev eth1 parent 1:1 handle 10:0 netem latency $LATENCY $JITTER $CORRELATION
+ # Start srnamed
+ python $SRHOME/stoneridge/srrun.py $SRHOME/stoneridge/srnamed.py --listen $MAINIP --pidfile $PIDFILE --log $LOGFILE
+ # Start apache
+ $SRHOME/bin/apachectl start
+}
+
+stop() {
+ # Stop apache
+ $SRHOME/bin/apachectl stop
+ # Stop srnamed
+ kill $(cat $PIDFILE)
+ # Remove network conditions
+ tc qdisc del dev eth1 root
+ # Remove ip addresses from eth1
+ ip addr del $MAINIP/12 dev eth1
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart|force-reload|reload)
+ stop
+ start
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart|reload|force-reload}"
+ exit 2
+esac

0 comments on commit 0bf2759

Please sign in to comment.