Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1/1] dcron: provide init script
Date: Thu, 17 Jul 2014 18:58:14 +0200	[thread overview]
Message-ID: <20140717165814.GB3737@free.fr> (raw)
In-Reply-To: <1405589648-26777-1-git-send-email-alvaro.gamez@hazent.com>

Alvaro, All,

On 2014-07-17 11:34 +0200, Alvaro G. M spake thusly:
> dcron doesn't create a pid file, so we run it in foreground but make
> start-stop-daemon create the pidfile and move the daemon to background.
> 
> Give it a number greater than exim's init script, so job output email
> can be sent.
> 
> Signed-off-by: Alvaro G. M <alvaro.gamez@hazent.com>
> ---
>  package/dcron/S90dcron | 22 ++++++++++++++++++++++
>  package/dcron/dcron.mk |  1 +
>  2 files changed, 23 insertions(+)
>  create mode 100644 package/dcron/S90dcron
> 
> diff --git a/package/dcron/S90dcron b/package/dcron/S90dcron
> new file mode 100644
> index 0000000..c2925fd
> --- /dev/null
> +++ b/package/dcron/S90dcron
> @@ -0,0 +1,22 @@
> +#!/bin/sh
> +
> +case "$1" in
> +	start)
> +		echo -n "Starting cron ... "
> +		start-stop-daemon -S -q -m -b -p /var/run/dcron.pid --exec /usr/sbin/crond -- -f
> +		echo "done."
> +		;;
> +	stop)
> +		echo -n "Stopping cron ..."
> +		start-stop-daemon -K -q -p /var/run/dcron.pid
> +		echo "done."
> +		;;
> +	restart)
> +		$0 stop
> +		sleep 1
> +		$0 start
> +		;;
> +	*)
> +		echo "usage: $0 {start|stop|restart}"
> +		;;
> +esac
> diff --git a/package/dcron/dcron.mk b/package/dcron/dcron.mk
> index 5174e38..e5a28f2 100644
> --- a/package/dcron/dcron.mk
> +++ b/package/dcron/dcron.mk
> @@ -27,6 +27,7 @@ define DCRON_INSTALL_TARGET_CMDS
>  	$(INSTALL) -d -m0755 $(TARGET_DIR)/var/spool/cron/crontabs \
>  	        $(TARGET_DIR)/etc/cron.daily $(TARGET_DIR)/etc/cron.hourly \
>  	        $(TARGET_DIR)/etc/cron.monthly $(TARGET_DIR)/etc/cron.weekly
> +	$(INSTALL) -m 0755 -D package/dcron/S90dcron $(TARGET_DIR)/etc/init.d/S90dcron

This should be in a DCRON_INSTALL_INIT_SYSV macro, see:
    http://buildroot.org/downloads/manual/manual.html#_infrastructure_for_packages_with_specific_build_systems

Also provide the systemd unit file (if it is available in the package!)
with the DCRON_INSTALL_INIT_SYSTEMD macro.

Regards,
Yann E. MORIN.

>  endef
>  
>  $(eval $(generic-package))
> -- 
> 2.0.1
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2014-07-17 16:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 10:21 [Buildroot] [PATCH v3 1/1] dcron: new package Alvaro G. M
2014-07-15 18:56 ` Thomas Petazzoni
2014-07-15 19:10   ` Alvaro G. M.
2014-07-15 19:17     ` Thomas Petazzoni
2014-07-17  9:34       ` [Buildroot] [PATCH 1/1] dcron: provide init script Alvaro G. M
2014-07-17 16:58         ` Yann E. MORIN [this message]
2014-07-17 18:35           ` Thomas Petazzoni
2014-07-17 19:00         ` Thomas Petazzoni

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=20140717165814.GB3737@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /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