Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run in background mode? #43

Closed
arjan-io opened this issue Nov 8, 2017 · 7 comments
Closed

Run in background mode? #43

arjan-io opened this issue Nov 8, 2017 · 7 comments

Comments

@arjan-io
Copy link

arjan-io commented Nov 8, 2017

Hi,

First of all, thanks for this great code!

I've tried fire homekit2mqtt up via and putty shows:

 sudo homekit2mqtt
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/avahi-compat?s=libdns_sd&e=node&f=DNSServiceRegister>
2017-11-08 16:03:20.374 <info>  homekit2mqtt 0.7.2 starting
2017-11-08 16:03:20.384 <info>  mqtt trying to connect mqtt://127.0.0.1
2017-11-08 16:03:20.595 <info>  using hap-nodejs version 0.4.36
2017-11-08 16:03:20.622 <info>  loading HomeKit to MQTT mapping file /usr/local/lib/node_modules/homekit2mqtt/example-homekit2mqtt.json
2017-11-08 16:03:20.736 <info>  hap created 10 Accessories
2017-11-08 16:03:20.737 <info>  hap publishing bridge "MQTT Bridge" username=CC:22:3D:E3:CE:F6 port=51826 pincode=031-45-154
2017-11-08 16:03:20.852 <info>  hap Bridge listening on port 51826
2017-11-08 16:03:20.853 <info>  http server listening on port 51888
2017-11-08 16:03:20.882 <info>  mqtt connected mqtt://127.0.0.1

After the last line, there is an empy line but no cursor. In other words, this putty window is now useless but I guess I have to keep it open to keep homekit2mqtt running.

Is there any way of running the program in background mode? I tried the usual '&' sign on the end but to no avail. Sorry if the solution is obvious but I am kind of stuck.

Thank you in advance.

@raufis27
Copy link

raufis27 commented Nov 8, 2017

What is you OS ? Linux or Mac ?

@arjan-io
Copy link
Author

arjan-io commented Nov 8, 2017

Should have mentioned. I run it on a RPI model 3, using Raspbian Stretch (full install, although I only use it via ssh).

@barto-
Copy link

barto- commented Nov 8, 2017

You can try nohup

@hobbyquaker
Copy link
Owner

hobbyquaker commented Nov 8, 2017

I suggest either to use https://github.com/Unitech/pm2 (pm2 is quite convenient and easy to use, handles also the logfiles and restarts...) or to create a systemd service (see e.g. http://nodesource.com/blog/running-your-node-js-app-with-systemd-part-1/)

@raufis27
Copy link

raufis27 commented Nov 8, 2017

You can run homekit2mqtt on startup using cron. Do -
crontab -e
@reboot homekit2mqtt [options]

Or
use rc-local [(https://www.raspberrypi.org/documentation/linux/usage/rc-local.md)] to setup startup script.

@sembsa
Copy link

sembsa commented Nov 8, 2017

Hi i have service:

[Unit]
Description=Strt HomeKit2MQTT

[Service]
ExecStart=/usr/local/bin/homekit2mqtt -p 51829 -v debug
StandardOutput=journal

[Install]
WantedBy=multi-user.target
Alias=homekit2mqtt.service

You need to copy the /etc/systemd/system/homekit2mqtt.service file, paste the code and then type:
sudo systemctl deamon-reload
sudo systemctl enable homekit2mqtt
sudo systemctl start homekit2mqtt

@arjan-io
Copy link
Author

arjan-io commented Nov 8, 2017

Oke, few options here. Thanks for the responses. I'll close the Issue for now and will reopen if I get stuck. Cheers.

@arjan-io arjan-io closed this as completed Nov 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants