{"action":"created","issue":{"url":"https://api.github.com/repos/urbanindo/yii2-queue/issues/30","repository_url":"https://api.github.com/repos/urbanindo/yii2-queue","labels_url":"https://api.github.com/repos/urbanindo/yii2-queue/issues/30/labels{/name}","comments_url":"https://api.github.com/repos/urbanindo/yii2-queue/issues/30/comments","events_url":"https://api.github.com/repos/urbanindo/yii2-queue/issues/30/events","html_url":"https://github.com/urbanindo/yii2-queue/issues/30","id":149389710,"number":30,"title":"Document (the lack of) init scripts for Listener","user":{"login":"mehrna","id":6211768,"avatar_url":"https://avatars.githubusercontent.com/u/6211768?v=3","gravatar_id":"","url":"https://api.github.com/users/mehrna","html_url":"https://github.com/mehrna","followers_url":"https://api.github.com/users/mehrna/followers","following_url":"https://api.github.com/users/mehrna/following{/other_user}","gists_url":"https://api.github.com/users/mehrna/gists{/gist_id}","starred_url":"https://api.github.com/users/mehrna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mehrna/subscriptions","organizations_url":"https://api.github.com/users/mehrna/orgs","repos_url":"https://api.github.com/users/mehrna/repos","events_url":"https://api.github.com/users/mehrna/events{/privacy}","received_events_url":"https://api.github.com/users/mehrna/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-04-19T08:42:47Z","updated_at":"2016-04-19T09:03:52Z","closed_at":null,"body":"The doc is nice but leaves for me the following topics open:\r\n1. how to start the listener at boot ( if it is ok! ), is there init scripts based on some OSes?\r\n2. how can I check whether the listener is running or not?\r\n\r\nHere I prefer a sample systemd service for Centos 7:\r\n\r\n`nano /lib/systemd/system/queue-listener.service`\r\n\r\n```shell\r\n[Unit]\r\nDescription=queue-listener\r\nAfter=network.target httpd.service mysqld.service\r\n\r\n[Service]\r\nUser=apache\r\nGroup=apache\r\nType=oneshot\r\nEnvironment=\"PATH=/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin\"\r\nExecStart=/var/www/html/ProjectFolderName/yii queue/listen\r\nRemainAfterExit=yes\r\n\r\n[Install]\r\nWantedBy=multi-user.target\r\n```\r\n\r\nAlso we could write an script and create a cron job to check if the service is running or not.\r\nThanks for any help you can provide."},"comment":{"url":"https://api.github.com/repos/urbanindo/yii2-queue/issues/comments/211813537","html_url":"https://github.com/urbanindo/yii2-queue/issues/30#issuecomment-211813537","issue_url":"https://api.github.com/repos/urbanindo/yii2-queue/issues/30","id":211813537,"user":{"login":"petrabarus","id":523289,"avatar_url":"https://avatars.githubusercontent.com/u/523289?v=3","gravatar_id":"","url":"https://api.github.com/users/petrabarus","html_url":"https://github.com/petrabarus","followers_url":"https://api.github.com/users/petrabarus/followers","following_url":"https://api.github.com/users/petrabarus/following{/other_user}","gists_url":"https://api.github.com/users/petrabarus/gists{/gist_id}","starred_url":"https://api.github.com/users/petrabarus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/petrabarus/subscriptions","organizations_url":"https://api.github.com/users/petrabarus/orgs","repos_url":"https://api.github.com/users/petrabarus/repos","events_url":"https://api.github.com/users/petrabarus/events{/privacy}","received_events_url":"https://api.github.com/users/petrabarus/received_events","type":"User","site_admin":false},"created_at":"2016-04-19T09:03:52Z","updated_at":"2016-04-19T09:03:52Z","body":"Hi @mehrna,\r\n\r\nThank you for the suggestion. We didn't have time to write the docs on how to deploy. You can always create something like [init script](https://www.linux.com/learn/managing-linux-daemons-init-scripts) and write the PID into a file like `/var/run/yii2-queue.pid`.\r\n\r\nIn our own deployment we use [supervisord](http://supervisord.org/). It is a very powerful process manager when you can do things like this:\r\n1. Make sure the service stays running (supervisord will automatically restart the process if the process gets terminated).\r\n2. Execute multiple process dynamically. You can set a configuration how many listener is running. When the queue gets long, you can increase the number of listener.\r\n3. See how many worker are running.\r\n4. More configuration on the process themselves."}}