if 'test -f /var/run/uwsgi/uwsgi.pid' { exec {'restart uwsgi': command => 'kill -HUP `cat /var/run/uwsgi/uwsgi.pid`', require => [ Exec['makemigrations'], Service['uwsgi']], } notify { 'uwsgi restarted': } } else { exec {'start server': command => 'uwsgi --master --emperor /etc/uwsgi/apps-enabled --daemonize /var/log/uwsgi/uwsgi_emperor.log --pidfile /var/run/uwsgi/uwsgi.pid', require => [ Exec['makemigrations'], Service['uwsgi']], } notify { 'uwsgi started': } }