From patchwork Thu Jul 17 09:34:08 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alvaro Gamez Machado X-Patchwork-Id: 371038 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from silver.osuosl.org (silver.osuosl.org [140.211.166.136]) by ozlabs.org (Postfix) with ESMTP id 1A6A91400DD for ; Thu, 17 Jul 2014 19:34:37 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id C77D632AAE; Thu, 17 Jul 2014 09:34:35 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5NRqhL-BIIUT; Thu, 17 Jul 2014 09:34:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 878A330713; Thu, 17 Jul 2014 09:34:32 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 8AC931C235D for ; Thu, 17 Jul 2014 09:34:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 842698AE6E for ; Thu, 17 Jul 2014 09:34:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pg-YWnHcDqaE for ; Thu, 17 Jul 2014 09:34:29 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wi0-f170.google.com (mail-wi0-f170.google.com [209.85.212.170]) by hemlock.osuosl.org (Postfix) with ESMTPS id 565B58AE56 for ; Thu, 17 Jul 2014 09:34:29 +0000 (UTC) Received: by mail-wi0-f170.google.com with SMTP id f8so6169961wiw.3 for ; Thu, 17 Jul 2014 02:34:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=aw57aRlqOjZlPrAobQggl089BgfUh2Xj4KP8qv1L6VY=; b=cgJx89Az8GkVlDyd+DiS2PZPuwRa7SvHvvkZQWlvYdpgGro7Ht0ZnGSrUNmhNNJQDK rVs/gi6l/h8AdoyyMAcj11gq8uwUawY96BjgoIAG6Oc9UcZxbebMzaQl05U2k2WSErBE ZGguNj3vd3Tvgv51IwI1ZF9YaBm0TY4IwQTiUedzE++9ekRiVoXcaIXbEjI/aDN/0Kes v0bXqmd35bgkDhUOM8T4o2ti3M63oihVrTxCOqemu8CoSPSYXzeUj71kGucUNFa9To21 2WMes83sZwYRAy6C4BsHj7nE0mv9LH3zqN446ny3VLphoRqmoexXe8wL+QHg+G2OmQ7B FUkg== X-Gm-Message-State: ALoCoQmiJiEH36Md1xkquGVZVDQYSXwloeIafostsFG1+qQUfXSM2tmWKn1pWrAtbrjyfATZ619+ X-Received: by 10.194.243.70 with SMTP id ww6mr42852299wjc.76.1405589667630; Thu, 17 Jul 2014 02:34:27 -0700 (PDT) Received: from collins.gmr.ssr.upm.es (collins.gmr.ssr.upm.es. [138.4.36.7]) by mx.google.com with ESMTPSA id x13sm19047633wib.23.2014.07.17.02.34.22 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 17 Jul 2014 02:34:26 -0700 (PDT) From: "Alvaro G. M" To: buildroot@uclibc.org, Thomas Petazzoni Date: Thu, 17 Jul 2014 11:34:08 +0200 Message-Id: <1405589648-26777-1-git-send-email-alvaro.gamez@hazent.com> X-Mailer: git-send-email 2.0.1 In-Reply-To: <20140715211719.0ea2e053@free-electrons.com> References: <20140715211719.0ea2e053@free-electrons.com> Subject: [Buildroot] [PATCH 1/1] dcron: provide init script X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net 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 --- 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 endef $(eval $(generic-package))