diff --git a/canto-test-docker-initd b/canto-test-docker-initd new file mode 100644 index 0000000000000000000000000000000000000000..28a7a98253d08e306232c5e666b8471a59216595 --- /dev/null +++ b/canto-test-docker-initd @@ -0,0 +1,38 @@ +#! /bin/sh +# /etc/init.d/canto + +# Installation instructions: https://github.com/pombase/canto/blob/master/etc/canto-init.d.md + +action=$1 +port=$2 + +WORKERS=5 +CANTO_SPACE='/data/export/canto-space/testing' + +PID_PATH=import_export/canto-test.pid + +# Carry out specific functions when asked to by the system +case "$action" in + start) + + echo "Starting Canto with $WORKERS workers" + + (date; cd $CANTO_SPACE; canto/script/canto_docker --non-interactive --use-container-name start_server --pid-file=/$PID_PATH --port $port -- script/canto_start --workers $WORKERS --keepalive-timeout 5 -s Starman --preload) >> canto-test.log 2>&1 & + ;; + stop) + pid=`/bin/cat $CANTO_SPACE/$PID_PATH` + echo stopping $pid + (cd $CANTO_SPACE; docker exec canto kill -TERM $pid) + ;; + restart) + pid=`/bin/cat $CANTO_SPACE/$PID_PATH` + echo restarting $pid + (cd $CANTO_SPACE; docker exec canto kill -HUP $pid) + ;; + *) + echo "Usage: $0 {start|restart|stop}" + exit 1 + ;; +esac + +exit 0