From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Fiona Klute via buildroot <buildroot@buildroot.org>
Cc: Fiona Klute <fiona.klute@gmx.de>,
"Alvaro G . M" <alvaro.gamez@hazent.com>
Subject: Re: [Buildroot] [PATCH 1/2] package/busybox: Add crond init script
Date: Mon, 15 Jul 2024 09:57:45 +0200 [thread overview]
Message-ID: <20240715095745.2b194a9b@windsurf> (raw)
In-Reply-To: <20240605111347.1581931-1-fiona.klute@gmx.de>
Hello Fiona,
On Wed, 5 Jun 2024 13:13:46 +0200
Fiona Klute via buildroot <buildroot@buildroot.org> wrote:
> The init script will be installed only if no other package provides
> cron (currently that could be package/dcron). Users will need to
> select a suitable location for their crontabs, using either runtime
> configuration in /etc/default/crond or Busybox build
> configuration. Note that crond fails to start if the crontabs
> directory doesn't exist.
>
> Signed-off-by: Fiona Klute <fiona.klute+wiwa@gmx.de>
Thanks, I applied your patch after making a few changes.
> +# Note that the Busybox default location for crontabs
> +# /var/spool/cron/crontabs is on a tmpfs in the default Buildroot
> +# filesystem layout. If you want persistent crontabs, override that
> +# either using either the "-c" runtime option of crond in CROND_ARGS,
> +# or the CONFIG_FEATURE_CROND_DIR Busybox build configuration option.
After discussion with Arnout, we decided that our default of
/var/spool/cron didn't make sense. Indeed the crontab generally needs
to be persistent, so having it in a tmpfs as the out-of-the-box
experience didn't seem very appropriate. So we changed the default
Busybox configuration to set CONFIG_FEATURE_CROND_DIR="/etc/cron". So
of course, I dropped your comment above.
> + printf 'Starting %s: ' "$DAEMON"
> + # shellcheck disable=SC2086 # we need the word splitting
> + start-stop-daemon -b -m -S -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \
Adjusted to use long options.
> + -- -f $CROND_ARGS
> + status=$?
> + if [ "$status" -eq 0 ]; then
> + echo "OK"
> + else
> + echo "FAIL"
> + fi
> + return "$status"
> +}
> +
> +stop() {
> + printf 'Stopping %s: ' "$DAEMON"
> + start-stop-daemon -K -q -p "$PIDFILE" -x "/usr/sbin/$DAEMON"
Ditto.
> + status=$?
> + # wait for process to be gone
> + while true; do
> + pid="$( cat "${PIDFILE}" 2>/dev/null || true )"
> + { [ -n "${pid}" ] && [ -d "/proc/${pid}" ]; } || break
> + sleep 0.1
> + done
And adjusted to use the loop of start-stop-daemon.
> +# Only install our crond script if no other package does it.
> +ifeq ($(BR2_PACKAGE_DCRON),)
> +define BUSYBOX_INSTALL_CROND_SCRIPT
> + if grep -q CONFIG_CROND=y $(@D)/.config; \
> + then \
And here we create $(TARGET_DIR)/etc/cron/crontabs/ to make sure it
exists, otherwise crond doesn't start.
> + $(INSTALL) -m 0755 -D package/busybox/S50crond \
> + $(TARGET_DIR)/etc/init.d/S50crond; \
> + fi;
> +endef
> +endif
Thanks for this work!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2024-07-15 7:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-05 11:13 [Buildroot] [PATCH 1/2] package/busybox: Add crond init script Fiona Klute via buildroot
2024-06-05 11:13 ` [Buildroot] [PATCH 2/2] package/busybox: Add ifplugd " Fiona Klute via buildroot
2024-07-15 8:27 ` Thomas Petazzoni via buildroot
2024-07-15 7:57 ` Thomas Petazzoni via buildroot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240715095745.2b194a9b@windsurf \
--to=buildroot@buildroot.org \
--cc=alvaro.gamez@hazent.com \
--cc=fiona.klute@gmx.de \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox