зеркало из https://github.com/mozilla/stoneridge.git
Update init scripts for OS X and Linux
This commit is contained in:
Родитель
5b57cde581
Коммит
b8e1505734
|
@ -17,19 +17,26 @@
|
|||
|
||||
### BEGIN CONFIGURATION SECTION
|
||||
SRHOME=/home/hurley/srhome
|
||||
CONFFILE=$SRHOME/stoneridge.ini
|
||||
MYIP=172.16.1.1
|
||||
### END CONFIGURATION SECTION
|
||||
|
||||
PIDFILE=$SRHOME/srdns.pid
|
||||
LOGFILE=$SRHOME/srdns.log
|
||||
SRROOT=$SRHOME/stoneridge
|
||||
SRRUN=$SRROOT/srrun.py
|
||||
DNSPID=$SRHOME/srdns.pid
|
||||
DNSLOG=$SRHOME/srdns.log
|
||||
WORKERPID=$SRHOME/srworker.pid
|
||||
WORKERLOG=$SRHOME/srworker.log
|
||||
|
||||
start() {
|
||||
ip addr add $MYIP/12 dev eth1
|
||||
python $SRHOME/stoneridge/srrun.py $SRHOME/stoneridge/srdns.py --pidfile $PIDFILE --log $LOGFILE
|
||||
python $SRRUN $SRROOT/srdns.py --pidfile $DNSPID --log $DNSLOG
|
||||
python $SRRUN $SRROOT/srworker.py --config $CONFFILE --pidfile $WORKERPID --log $WORKERLOG
|
||||
}
|
||||
|
||||
stop() {
|
||||
kill $(cat $PIDFILE)
|
||||
kill $(cat $WORKERPID)
|
||||
kill $(cat $DNSPID)
|
||||
ip addr del $MYIP/12 dev eth1
|
||||
}
|
||||
|
||||
|
|
|
@ -18,14 +18,24 @@
|
|||
|
||||
### BEGIN CONFIGURATION SECTION
|
||||
SRHOME=/home/hurley/srhome
|
||||
CONFFILE=$SRHOME/stoneridge.ini
|
||||
### END CONFIGURATION SECTION
|
||||
|
||||
CONFFILE=$SRHOME/stoneridge.ini
|
||||
SRROOT=$SRHOME/stoneridge
|
||||
SRRUN=$SRROOT/srrun.py
|
||||
MASTERPID=$SRHOME/srmaster.pid
|
||||
MASTERLOG=$SRHOME/srmaster.log
|
||||
REPORTERPID=$SRHOME/srreporter.pid
|
||||
REPORTERLOG=$SRHOME/srreporter.log
|
||||
|
||||
start() {
|
||||
python $SRRUN $SRROOT/srmaster.py --config $CONFFILE --pidfile $MASTERPID --log $MASTERLOG
|
||||
python $SRRUN $SRROOT/srreporter.py --config $CONFFILE --pidfile $REPORTERPID --log $REPORTERLOG
|
||||
}
|
||||
|
||||
stop() {
|
||||
kill $(cat $REPORTERPID)
|
||||
kill $(cat $MASTERPID)
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
### BEGIN CONFIGURATION SECTION
|
||||
SRHOME=/home/hurley/srhome
|
||||
CONFFILE=$SRHOME/stoneridge.ini
|
||||
MAINIP=172.17.0.1
|
||||
RATE=10mbit
|
||||
MAXBURST=10240
|
||||
|
@ -30,8 +31,12 @@ JITTER=
|
|||
CORRELATION=
|
||||
### END CONFIGURATION SECTION
|
||||
|
||||
PIDFILE=$SRHOME/srnamed.pid
|
||||
LOGFILE=$SRHOME/srnamed.log
|
||||
SRROOT=$SRHOME/stoneridge
|
||||
SRRUN=$SRROOT/srrun.py
|
||||
NAMEDPID=$SRHOME/srnamed.pid
|
||||
NAMEDLOG=$SRHOME/srnamed.log
|
||||
SCHEDULERPID=$SRHOME/srscheduler.pid
|
||||
SCHEDULRELOG=$SRHOME/srscheduler.log
|
||||
|
||||
start() {
|
||||
# Setup eth1 to have an address
|
||||
|
@ -40,7 +45,9 @@ start() {
|
|||
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
|
||||
python $SRRUN $SRROOT/srnamed.py --listen $MAINIP --pidfile $NAMEDPID --log $NAMEDLOG
|
||||
# Start srscheduler
|
||||
python $SRRUN $SRROOT/srscheduler.py --config $CONFFILE --pidfile $SCHEDULERPID --log $SCHEDULERLOG
|
||||
# Start apache
|
||||
$SRHOME/bin/apachectl start
|
||||
}
|
||||
|
@ -48,8 +55,10 @@ start() {
|
|||
stop() {
|
||||
# Stop apache
|
||||
$SRHOME/bin/apachectl stop
|
||||
# Stop srscheduler
|
||||
kill $(cat $SCHEDULERPID)
|
||||
# Stop srnamed
|
||||
kill $(cat $PIDFILE)
|
||||
kill $(cat $NAMEDPID)
|
||||
# Remove network conditions
|
||||
tc qdisc del dev eth1 root
|
||||
# Remove ip addresses from eth1
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>Label</key>
|
||||
<string>org.mozilla.srworker</string>
|
||||
<key>ProgramArguments</key>
|
||||
<array>
|
||||
<string>/usr/local/bin/python</string>
|
||||
<string>/Users/hurley/srhome/stoneridge/srworker.py</string>
|
||||
<string>--config</string>
|
||||
<string>/Users/hurley/srhome/stoneridge.ini</string>
|
||||
<string>--nodaemon</string>
|
||||
<string>--log</string>
|
||||
<string>/Users/hurley/srhome/srworker.log</string>
|
||||
</array>
|
||||
<key>KeepAlive</key>
|
||||
<true/>
|
||||
<key>WorkingDirectory</key>
|
||||
<string>/Users/hurley/srhome/stoneridge</string>
|
||||
<key>EnvironmentVariables</key>
|
||||
<dict>
|
||||
<key>PATH</key>
|
||||
<string>/usr/local/share/python:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
Загрузка…
Ссылка в новой задаче