🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.raspberry-pi
Article #85

Re: Starting a NODE app from a Cron job or start-on-boot

#85
From: Lawrence D’Oliveiro
Date: Thu, 12 Nov 2026 20:18
17 lines
1937 bytes
On Thu, 12 Nov 2026 13:34:27 +0000, NY wrote:

> The script runs fine - all the logging stuff is OK. But it seems
> that "node" does not like running as a background job any more when
> invoked from a cron job as opposed to a terminal session.

What exactly is the error?

> The reason it's run from a cron job is that it has a habit of
> crashing every so often (no idea why, and writer of the app doesn't
> reply to emails) so I run it from cron every 5 minutes to restart it
> if it has stopped.

I would do this via a systemd service definition. That provides
automatic monitoring and restarting if/when it crashes (up to some
reasonable limit, to guard against endless loops). And any error
messages should appear in the journal as well.
Technical Details
Message-ID: <11d56us$8idc$3@dont-email.me>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
References: <11d4f94$3ve0f$1@dont-email.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.hispagatos.org!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail
From: Lawrence D’Oliveiro <ldo@nz.invalid>
Newsgroups: comp.sys.raspberry-pi
Subject: Re: Starting a NODE app from a Cron job or start-on-boot
Date: Thu, 12 Nov 2026 20:18:37 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <11d56us$8idc$3@dont-email.me>
References: <11d4f94$3ve0f$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Thu, 12 Nov 2026 20:18:37 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="281004"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18RPMs/M9S4DyRcNVHa5QIA"; posting-host="33d00acd775bfe61d11222a1d44a73f8"
User-Agent: Pan/0.165 (Kostiantynivka)
Cancel-Lock: sha1:LW7GJolQTZv6PI3zdl0yuc5JE8Q= sha256:/YmkbOMXA+Y4/kKoXBBHIaUhzOuBEOfDhIabdxVw/YA=
	sha1:f4lmUtUeCbwEIBjlAm7GFGztIuw= sha256:KxOYrm/jdWMDhzcmovneGngVPqq9kk/BZ2ISJ/uVqAc=