PWD = $(shell pwd)
SERVICECONFIG = $(PWD)/../../../cfg/services/services.local.$(USER).xml
PIDFILE = $(PWD)/wiki-acl.pid
STARTAS = $(PWD)/wiki-acl

stop:
	if [ -e $(PIDFILE) ]; then \
				 if [ -f /proc/`head -1 $(PIDFILE)`/status ];then \
						/sbin/start-stop-daemon --stop --pidfile $(PIDFILE) --retry 3 ;\
						rm -f $(PIDFILE); \
				 fi; \
		fi
	rm -f nohup.out
start: stop
	ya make
	ulimit -c unlimited; YCR_MODE=fastcgi:/tmp/yandex-maps-wiki-acl-$(USER).sock nohup /sbin/start-stop-daemon -m --pidfile $(PIDFILE) --start --startas $(STARTAS) $(SERVICECONFIG)&
	while ! ( test -S /tmp/yandex-maps-wiki-acl-$(USER).sock ); do sleep 1; echo -n '.'; done ; echo
	sleep 3
	chmod a+rw /tmp/yandex-maps-wiki-acl-$(USER).sock
