Fossil SCM

fossil-scm / tools / fslsrv
Source Blame History 59 lines
062d2bf… wyoung 1 #!/bin/bash
062d2bf… wyoung 2 FOSSIL=fossil
1cbcb38… wyoung 3 PGARGS="-P 1"
062d2bf… wyoung 4 OLDPID=`pgrep -P 1 fossil`
1cbcb38… wyoung 5 SITE=https://example.com
1cbcb38… wyoung 6 PORT=12345
062d2bf… wyoung 7
062d2bf… wyoung 8 if [ "$1" = "-f" ] ; then PGARGS= ; shift ; fi
062d2bf… wyoung 9
062d2bf… wyoung 10 if [ -n "$OLDPID" ]
062d2bf… wyoung 11 then
062d2bf… wyoung 12 echo "Killing running Fossil server first..."
062d2bf… wyoung 13 pkill $PGARGS fossil
062d2bf… wyoung 14
062d2bf… wyoung 15 for i in $(seq 30)
062d2bf… wyoung 16 do
062d2bf… wyoung 17 if [ -n "$(pgrep $PGARGS fossil)" ]
062d2bf… wyoung 18 then
062d2bf… wyoung 19 if [ $i -eq 1 ]
062d2bf… wyoung 20 then
062d2bf… wyoung 21 echo -n "Waiting for it to die..."
062d2bf… wyoung 22 else
062d2bf… wyoung 23 echo -n .
062d2bf… wyoung 24 fi
062d2bf… wyoung 25 sleep '0.1'
062d2bf… wyoung 26 else
062d2bf… wyoung 27 break
062d2bf… wyoung 28 fi
062d2bf… wyoung 29 echo
062d2bf… wyoung 30 done
062d2bf… wyoung 31
062d2bf… wyoung 32 killall -9 fossil 2> /dev/null
062d2bf… wyoung 33 fi
062d2bf… wyoung 34
062d2bf… wyoung 35 if [ -x ./fossil ]
062d2bf… wyoung 36 then
062d2bf… wyoung 37 # We're running from a build tree, so use that version instead
062d2bf… wyoung 38 FOSSIL=./fossil
062d2bf… wyoung 39 fi
062d2bf… wyoung 40
062d2bf… wyoung 41 function start_one() {
062d2bf… wyoung 42 bn=$1
1cbcb38… wyoung 43 ln="$2"
1cbcb38… wyoung 44
1cbcb38… wyoung 45 $FOSSIL server $extra \
1cbcb38… wyoung 46 --scgi \
1cbcb38… wyoung 47 --localhost \
1cbcb38… wyoung 48 --port $PORT \
1cbcb38… wyoung 49 --jsmode bundled \
1cbcb38… wyoung 50 --baseurl ${SITE}/$bn \
1cbcb38… wyoung 51 --errorlog ~/log/fossil/$bn-errors.log \
1cbcb38… wyoung 52 ~/museum/$bn.fossil > ~/log/fossil/$bn-stdout.log &
1cbcb38… wyoung 53 echo Started $ln Fossil server, port $PORT, PID $!.
1cbcb38… wyoung 54 PORT=$(($PORT + 1))
062d2bf… wyoung 55 }
062d2bf… wyoung 56
1cbcb38… wyoung 57 start_one first "First Project"
1cbcb38… wyoung 58 start_one second "Second Project"
1cbcb38… wyoung 59 start_one third "Third Project"

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button