{"action":"created","issue":{"url":"https://api.github.com/repos/openhab/openhab-distro/issues/328","repository_url":"https://api.github.com/repos/openhab/openhab-distro","labels_url":"https://api.github.com/repos/openhab/openhab-distro/issues/328/labels{/name}","comments_url":"https://api.github.com/repos/openhab/openhab-distro/issues/328/comments","events_url":"https://api.github.com/repos/openhab/openhab-distro/issues/328/events","html_url":"https://github.com/openhab/openhab-distro/issues/328","id":190059839,"number":328,"title":"Service Start/Stop for Debian (Ubuntu 14.04) stores wrong pid number","user":{"login":"NickWaterton","id":11572327,"avatar_url":"https://avatars.githubusercontent.com/u/11572327?v=3","gravatar_id":"","url":"https://api.github.com/users/NickWaterton","html_url":"https://github.com/NickWaterton","followers_url":"https://api.github.com/users/NickWaterton/followers","following_url":"https://api.github.com/users/NickWaterton/following{/other_user}","gists_url":"https://api.github.com/users/NickWaterton/gists{/gist_id}","starred_url":"https://api.github.com/users/NickWaterton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NickWaterton/subscriptions","organizations_url":"https://api.github.com/users/NickWaterton/orgs","repos_url":"https://api.github.com/users/NickWaterton/repos","events_url":"https://api.github.com/users/NickWaterton/events{/privacy}","received_events_url":"https://api.github.com/users/NickWaterton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-17T14:20:16Z","updated_at":"2016-12-05T14:03:53Z","closed_at":null,"body":"This may be related to issue #327 I have found that the pid stored in /var/run/openhab2.pid is incorrect when starting openhab2 as a service (sudo service openhab2 start). This means you can start more than one instance of openhab2 (which makes it hang), and you can't stop openhab2 in the usual way (sudo service openhab2 stop). This is probably what is happening in issue #327 \r\n\r\nI believe this is because openhab2 isn't started directly by start-stop-daemon, but is started by a series of wrapper scripts. The pid stored is probably one of the wrapper scripts (which forks and exits).\r\n\r\nUsually you would update the pid from one of the wrapper scripts, but because the user changes to openhab:openhab, the scripts don't have permission to update /var/run/openhab2.pid.\r\n\r\nEither the pid file needs to be moved, (to /var/run/openhab2/openhab2.pid for example - so that the ownership can be assigned to openhab) and updated by the actual scripts starting the openhab2 java executable, or a mechanism within /etc/init.d/openhab2 needs to be implemented to update the /var/run/openhab2.pid file with the actual pid of the java main process.\r\n\r\nI implemented a quick and dirty version of the latter using pidof to get the real pid into /var/run/openhab2.pid as an immediate solution, but there are probably much better solutions out there."},"comment":{"url":"https://api.github.com/repos/openhab/openhab-distro/issues/comments/264861595","html_url":"https://github.com/openhab/openhab-distro/issues/328#issuecomment-264861595","issue_url":"https://api.github.com/repos/openhab/openhab-distro/issues/328","id":264861595,"user":{"login":"BClark09","id":8983584,"avatar_url":"https://avatars.githubusercontent.com/u/8983584?v=3","gravatar_id":"","url":"https://api.github.com/users/BClark09","html_url":"https://github.com/BClark09","followers_url":"https://api.github.com/users/BClark09/followers","following_url":"https://api.github.com/users/BClark09/following{/other_user}","gists_url":"https://api.github.com/users/BClark09/gists{/gist_id}","starred_url":"https://api.github.com/users/BClark09/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BClark09/subscriptions","organizations_url":"https://api.github.com/users/BClark09/orgs","repos_url":"https://api.github.com/users/BClark09/repos","events_url":"https://api.github.com/users/BClark09/events{/privacy}","received_events_url":"https://api.github.com/users/BClark09/received_events","type":"User","site_admin":false},"created_at":"2016-12-05T14:03:53Z","updated_at":"2016-12-05T14:03:53Z","body":"Note that if you stop the service then openhab will shutdown safely. This means that for a little while, (up to 15 seconds I think) there will still be a process. My changes to init.d use `pgrep java -G openhab` to obtain and update the PID file. \r\n\r\nAlso note that this only effects Ubuntu <15.* since systemd configurations won't generate a PID file, and uses a smarter daemon configuration that ensures only one process is running regardless of how many times you use try to start it."}}
{"actor":{"display_login":"BClark09"}}