On my Pi3B+ I had pigpiod configured to run on boot and I can successfully run compiled c programs; specifically DHTXXD.c which contains:-
/*
DHTXXD.c
2016-02-16
Public Domain
*/
#include <stdio.h>
#include <stdlib.h>
#include <pigpiod_if2.h>
However when I try to run pigs hwver
I get an error "socket connect failed" even though systemctl status pigpiod
shows it is running and port 8888 is open.
Indeed any pigs
command failed.
I disabled and reenabled pigpiod
with sudo systemctl enable pigpiod
which responded:-
Created symlink /etc/systemd/system/multi-user.target.wants/pigpiod.service → /lib/systemd/system/pigpiod.service.
When I disable pigpiod
on boot then DHTXXD
fails.
If I manually enable with sudo pigpiod
then both work.
With pigpiod
manually started
$ sudo systemctl status pigpiod
● pigpiod.service - Daemon required to control GPIO pins via pigpio
Loaded: loaded (/lib/systemd/system/pigpiod.service; disabled; vendor preset: enabled)
Active: inactive (dead)
With pigpiod
automatically started
$ sudo systemctl status pigpiod
● pigpiod.service - Daemon required to control GPIO pins via pigpio
Loaded: loaded (/lib/systemd/system/pigpiod.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2018-12-13 12:18:39 AEDT; 35s ago
Process: 347 ExecStart=/usr/bin/pigpiod -l (code=exited, status=0/SUCCESS)
Main PID: 371 (pigpiod)
CGroup: /system.slice/pigpiod.service
└─371 /usr/bin/pigpiod -l
Anyone have any idea to make reliable autostart?
systemd
setup - I use the older (non-standard these days) sysVinit
to run my own daemon from that setup's/erc/rc.local
that spawns a separatepigpiod
thread - and from what I recall of @joan 's pigpio library it used to (I am not sure that it used the same mechanism nowadays) check that there is only one instance running by looking for a/run/pigpiod.pid
file - but if it crashed previously that file might still be around and be preventing a new instance from starting...