• Easiest way to start a daemon - Pi Zero

    From The Natural Philosopher@3:770/3 to All on Fri Aug 11 12:35:24 2023
    Having finally fixed its bugs (don't ask) I have a perfect little daemon
    that pops itself in background and runs indefinitely, It isn't leaking
    memory and its not crashing and there is no reason it ever should, It
    accesses files but these will always be present and correct. It will
    never need to be killed or HUPed to relaod itself.

    What is the absolute simplest way to autostart it. /etc/init.d and a
    script linked to etc/rc?.d? systemd?

    Raspios is the Os.


    --
    New Socialism consists essentially in being seen to have your heart in
    the right place whilst your head is in the clouds and your hand is in
    someone else's pocket.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From yeti@3:770/3 to All on Fri Aug 11 11:44:38 2023
    ...an @reboot line in crontab?

    --
    Take Back Control! -- Mesh The Planet!
    I do not play Nethack, I do play GNUS! o;-)
    Solid facts do not need 1001 pictures.

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From The Natural Philosopher@3:770/3 to yeti on Fri Aug 11 13:05:08 2023
    On 11/08/2023 12:44, yeti wrote:
    ...an @reboot line in crontab?

    Yup, I guess that's another one! I'd forgotten that!


    --
    "Strange as it seems, no amount of learning can cure stupidity, and
    higher education positively fortifies it."

    - Stephen Vizinczey

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Ahem A Rivet's Shot@3:770/3 to The Natural Philosopher on Fri Aug 11 13:21:48 2023
    On Fri, 11 Aug 2023 12:35:25 +0100
    The Natural Philosopher <tnp@invalid.invalid> wrote:

    What is the absolute simplest way to autostart it. /etc/init.d and a
    script linked to etc/rc?.d? systemd?

    /etc/rc.local - if it still exists.

    --
    Steve O'Hara-Smith
    Odds and Ends at http://www.sohara.org/
    Host: Beautiful Theory meet Inconvenient Fact
    Obit: Beautiful Theory died today of factual inconsistency

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Chris Elvidge@3:770/3 to The Natural Philosopher on Fri Aug 11 14:35:20 2023
    On 11/08/2023 12:35, The Natural Philosopher wrote:
    Having finally fixed its bugs (don't ask) I have a perfect little daemon
    that pops itself in background and runs indefinitely, It isn't leaking
    memory and its not crashing and there is no reason it ever should, It accesses files but these will always be present and correct. It will
    never need to be killed or HUPed to relaod itself.

    What is the absolute simplest way to autostart it. /etc/init.d and a
    script linked to etc/rc?.d? systemd?

    Raspios is the Os.


    I've just installed pigpiod

    /lib/systemd/system/pigpiod.service

    [Unit]
    Description=Daemon required to control GPIO pins via pigpio
    [Service]
    ExecStart=/usr/bin/pigpiod -l
    ExecStop=/bin/systemctl kill pigpiod
    Type=forking
    [Install]
    WantedBy=multi-user.target

    And then 'systemctl enable pigpiod.service' to put in a link in /etc/systemd/system/multi-user.target.wants

    If you change the relevant lines, it should work.


    --

    Chris Elvidge, England
    I WILL NOT SELL MY KIDNEY ON eBAY

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From The Natural Philosopher@3:770/3 to Ahem A Rivet's Shot on Fri Aug 11 16:14:16 2023
    On 11/08/2023 13:21, Ahem A Rivet's Shot wrote:
    On Fri, 11 Aug 2023 12:35:25 +0100
    The Natural Philosopher <tnp@invalid.invalid> wrote:

    What is the absolute simplest way to autostart it. /etc/init.d and a
    script linked to etc/rc?.d? systemd?

    /etc/rc.local - if it still exists.

    Seems to. Whether it is as redundant as tits on a bull, is less obvious.
    --
    In a Time of Universal Deceit, Telling the Truth Is a Revolutionary Act.

    - George Orwell

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From The Natural Philosopher@3:770/3 to Chris Elvidge on Fri Aug 11 16:15:32 2023
    On 11/08/2023 14:35, Chris Elvidge wrote:
    On 11/08/2023 12:35, The Natural Philosopher wrote:
    Having finally fixed its bugs (don't ask) I have a perfect little
    daemon that pops itself in background and runs indefinitely, It isn't
    leaking memory and its not crashing and there is no reason it ever
    should, It accesses files but these will always be present and
    correct.  It will never need to be killed or HUPed to relaod itself.

    What is the absolute simplest way to autostart it. /etc/init.d and a
    script linked to etc/rc?.d? systemd?

    Raspios is the Os.


    I've just installed pigpiod

    /lib/systemd/system/pigpiod.service

    [Unit]
    Description=Daemon required to control GPIO pins via pigpio
    [Service]
    ExecStart=/usr/bin/pigpiod -l
    ExecStop=/bin/systemctl kill pigpiod
    Type=forking
    [Install]
    WantedBy=multi-user.target

    And then 'systemctl enable pigpiod.service' to put in a link in /etc/systemd/system/multi-user.target.wants

    If you change the relevant lines, it should work.


    Ah, that looks neat. Is the "Type=forking" there to tell systemd not to
    expect it *not* to return?

    --
    In a Time of Universal Deceit, Telling the Truth Is a Revolutionary Act.

    - George Orwell

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Chris Elvidge@3:770/3 to The Natural Philosopher on Fri Aug 11 16:59:34 2023
    On 11/08/2023 16:15, The Natural Philosopher wrote:
    On 11/08/2023 14:35, Chris Elvidge wrote:
    On 11/08/2023 12:35, The Natural Philosopher wrote:
    Having finally fixed its bugs (don't ask) I have a perfect little
    daemon that pops itself in background and runs indefinitely, It isn't
    leaking memory and its not crashing and there is no reason it ever
    should, It accesses files but these will always be present and
    correct. It will never need to be killed or HUPed to relaod itself.

    What is the absolute simplest way to autostart it. /etc/init.d and a
    script linked to etc/rc?.d? systemd?

    Raspios is the Os.


    I've just installed pigpiod

    /lib/systemd/system/pigpiod.service

    [Unit]
    Description=Daemon required to control GPIO pins via pigpio
    [Service]
    ExecStart=/usr/bin/pigpiod -l
    ExecStop=/bin/systemctl kill pigpiod
    Type=forking
    [Install]
    WantedBy=multi-user.target

    And then 'systemctl enable pigpiod.service' to put in a link in
    /etc/systemd/system/multi-user.target.wants

    If you change the relevant lines, it should work.


    Ah, that looks neat. Is the "Type=forking" there to tell systemd not to expect it *not* to return?


    See: https://www.freedesktop.org/software/systemd/man/systemd.service.html

    --

    Chris Elvidge, England
    WEDGIES ARE UNHEALTHY FOR CHILDREN AND OTHER LIVING THINGS

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Knute Johnson@3:770/3 to The Natural Philosopher on Fri Aug 11 10:31:56 2023
    On 8/11/23 10:15, The Natural Philosopher wrote:

    Ah, that looks neat.  Is the "Type=forking" there to tell systemd not to expect it *not* to return?


    Type=simple for a program that just goes off on its own.

    --

    Knute Johnson

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)
  • From Computer Nerd Kev@3:770/3 to The Natural Philosopher on Sat Aug 12 09:42:36 2023
    The Natural Philosopher <tnp@invalid.invalid> wrote:
    On 11/08/2023 13:21, Ahem A Rivet's Shot wrote:
    On Fri, 11 Aug 2023 12:35:25 +0100
    The Natural Philosopher <tnp@invalid.invalid> wrote:

    What is the absolute simplest way to autostart it. /etc/init.d and a
    script linked to etc/rc?.d? systemd?

    /etc/rc.local - if it still exists.

    Seems to. Whether it is as redundant as tits on a bull, is less obvious.

    As of some years ago it existed, but didn't do anything, in RPi OS.
    I found various guides online for enabling it with Systemd, none of
    which worked because Systemd obviously changes its workings every
    other week. I eventually wrote a script to perform all the
    ridiculously over-complicated and opaque configuration scripts to
    make it work on a fresh install. I posted that script once in this
    group. I won't bother digging it up again now because it seems
    extremely likely that by now Systemd will have changed again and it
    will be as broken in current RPi OS as the various outdated
    tutorials that I spent hours trying to follow originally.

    The complication is wanting a process to run after everything else,
    not just after some specific things have been started. Systemd is
    designed to cater for the latter case, and if you're building the
    OS from the ground up that's probably fine, but making it so
    complicated to do the former is just unforgivable in my opinion.

    I now consider RPi OS as just an example system from which to take
    inspiration for implementing software in a more sane, Systemd-free, environment.

    --
    __ __
    #_ < |\| |< _#

    --- SoupGate-Win32 v1.05
    * Origin: Agency HUB, Dunedin - New Zealand | Fido<>Usenet Gateway (3:770/3)