Nekmo / amazon-dash

Hack your Amazon Dash to run what you want.
MIT License
828 stars 67 forks source link

Systemd service does not work after reboot #132

Closed scharrin2 closed 5 years ago

scharrin2 commented 5 years ago

Put an x into all the boxes [ ] relevant to your issue (like this: [x])

What is the purpose of your issue?

Guideline for bug reports

You can delete this section if your report is not a bug

How to get your version:

amazon-dash --version
python --version
pip --version
easy_install --version

Description

I setup the autostart Smith the commands sudo systemctl start amazon-dash

After a reboot I can see that the amazon-dash is running

pi@servberry:~ $ sudo systemctl status amazon-dash ● amazon-dash.service - Amazon Dash service Loaded: loaded (/lib/systemd/system/amazon-dash.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2019-03-06 19:40:31 CET; 1min 2s ago Main PID: 330 (amazon-dash) CGroup: /system.slice/amazon-dash.service └─330 /usr/bin/python /usr/local/bin/amazon-dash run --config /etc/amazon-dash.yml

Mar 06 19:40:31 servberry systemd[1]: Started Amazon Dash service. Mar 06 19:40:32 servberry env[330]: Welcome to Amazon-dash v1.3.2 using Python 2.7.13 Mar 06 19:40:32 servberry env[330]: Listening for events. Amazon-dash will execute the events associated with the r lines 1-10/10 (END)

But when I press the button on the Dash button, nothing happens.

What I Did

When restarting the amazon-dash with the command

sudo systemctl restart amazon-dash

the Dash-Button works

Nekmo commented 5 years ago

Maybe amazon-dash should wait for the network to be available to start. Include this in your amazon-dash.service:

After=network-online.target
Wants=network-online.target

And reload daemons:

systemctl daemon-reload
scharrin2 commented 5 years ago

Yes - now it works.

I put the two lines in the [Unit] section:

[Unit]
Description=Amazon Dash service
After=network-online.target
Wants=network-online.target

[Service]
User=root
ExecStart=/usr/bin/env amazon-dash run --config /etc/amazon-dash.yml
Restart=always
RestartSec=3

[Install]
WantedBy=multi-user.target

Best regards, Christian

Nekmo commented 5 years ago

Thanks :) I will add this change to the next release.