File: //etc/init/gcpd.conf
description "google cloud print daemon"
author "System Integration Team"
normal exit 0
start on started cupsd
stop on stopping cupsd
console log
expect fork
respawn
respawn limit 5 10
pre-start script
GCP_NUM=`/usr/syno/bin/synoprint --list | xargs -n 1 /usr/syno/bin/synoprint --ckgcp $1 | grep on | wc -l` || true
if [ ${GCP_NUM} -ne 1 ]; then
stop; exit 0
fi
if ! /usr/syno/sbin/synoservice --status cupsd > /dev/null 2>&1; then
echo "cupsd is not running, exit."
stop; exit 0;
fi
end script
exec /usr/bin/gcpd
post-stop exec sleep 2