From owner-freebsd-questions@freebsd.org Sat Aug 22 07:11:25 2020 Return-Path: Delivered-To: freebsd-questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2CDB3AF763 for ; Sat, 22 Aug 2020 07:11:25 +0000 (UTC) (envelope-from odhiambo@gmail.com) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 4BYV193737z4G1C for ; Sat, 22 Aug 2020 07:11:25 +0000 (UTC) (envelope-from odhiambo@gmail.com) Received: by mailman.nyi.freebsd.org (Postfix) id 6B1BF3AF762; Sat, 22 Aug 2020 07:11:25 +0000 (UTC) Delivered-To: questions@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 69D483B02F2 for ; Sat, 22 Aug 2020 07:11:25 +0000 (UTC) (envelope-from odhiambo@gmail.com) Received: from mail-ot1-x330.google.com (mail-ot1-x330.google.com [IPv6:2607:f8b0:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BYV183M8lz4Fxx for ; Sat, 22 Aug 2020 07:11:24 +0000 (UTC) (envelope-from odhiambo@gmail.com) Received: by mail-ot1-x330.google.com with SMTP id q9so3367820oth.5 for ; Sat, 22 Aug 2020 00:11:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=DbMdgTNNRR63xkszrTeped1femzTTtM5eU6soXCDcZI=; b=BqmNl5sHZ9ndCrg+rWIXxlAgEu0ZaqZoIspFpjMZbDHFRWDYoIW0uSUH6kaayUtzTg anuiinxyBlMiQhI1N7DuFZxd/uKEgscv0uUSmcLbouiC4fuIZ6kLB/xD53/NYT2mfpl4 4O/b80mgf2gWoBtCbANA7J/MaDFzPgNTjNgxc+ncyfDUIElVYVfRs221l4gVKbjp6r8o rYbtfXBWEDEX1qRcz0qa+xqucwR24VakRJ44/Wqwu6b1UU8zRA06VKR3M42IJjUsk248 5LSuhOSf85ZryuUfSSUFKbGW8GZ53HXZYKMQ7tkYkNLoi67gF4J4p8Y/6wRaEgjUmv7O IGQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=DbMdgTNNRR63xkszrTeped1femzTTtM5eU6soXCDcZI=; b=WgY3s6JenAf4KraF1k7/YlYXmitYsVWzxpF+4uO4vtSsjS64Q9kl3pGXSsmSR2i78M ZoyioD0wFXDYqqM0QFGJJ8+TDo406eUAAgbr9vraSXY++bhIXJSVNlf9APrTcOctCTwi F3vjwiGsWLKhHsH9+CXwUSwrNTX82PdvEKZD9dlkqWjBl+rDCf8nXiHlU0QCKi7fhJL4 a6IOJLeiFPbMozHWkSjn2QzMGebriKBnsEm83BR6nP4Wm4wwZZORDOXpOTu31oOjMkGC c4VK2YiB/5g60R7O+h+21zoe0Xc/0tsf4I2lI32ia2/F5S7DpSiueyWOTMMOPRE0f9Ml K/fg== X-Gm-Message-State: AOAM531DtJLWHXoT6w/noDd8dAJY5rIGY94KQCdP5k2BKsRNxT6GOLLo FrTzkxH0xy4lffuFsBteB7oQBpSAgaeS64qgKz3Lx1+x0PQa9g== X-Google-Smtp-Source: ABdhPJxNec6B/pZ//l8LW98JTGpPg/7mv/2LNcQPDdakhyMz1kB5HvPl0fOprI5YZF6Q9E5iVYc2V5+GABy9dol+ogU= X-Received: by 2002:a05:6830:1486:: with SMTP id s6mr4648053otq.248.1598080282626; Sat, 22 Aug 2020 00:11:22 -0700 (PDT) MIME-Version: 1.0 From: Odhiambo Washington Date: Sat, 22 Aug 2020 10:10:46 +0300 Message-ID: Subject: creating a startup script for a foreign application To: questions X-Rspamd-Queue-Id: 4BYV183M8lz4Fxx X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=BqmNl5sH; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of odhiambo@gmail.com designates 2607:f8b0:4864:20::330 as permitted sender) smtp.mailfrom=odhiambo@gmail.com X-Spamd-Result: default: False [-1.20 / 15.00]; ARC_NA(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[questions@freebsd.org]; RCPT_COUNT_ONE(0.00)[1]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2607:f8b0:4864:20::330:from]; NEURAL_HAM_SHORT(-0.20)[-0.200]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[questions]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.33 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Aug 2020 07:11:25 -0000 Hi good people, I am looking for assistance in creating a startup script for rc.d/ to automatically start/stop a service upon reboot. I have installed Mailman3.x in a python virtual environment and I have adopted a script from Linux to control it. I am able to use the script to manually start|stop the application. However, it does not work when I reboot the system. Hoping someone can help me tinker with it so that it works with system reboots. Below is the content of the script currently. #!/usr/local/bin/bash ### BEGIN INIT INFO # Provides: GNU Mailman # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Mailman Service # Description: service control for Mailman ### END INIT INFO PATH=/opt/mailman/mm/bin:/opt/mailman/mm/venv/bin:/usr/sbin:/usr/bin:/bin:/sbin: DESC="GNU Mailman service" DAEMON=/opt/mailman/mm/bin/mailman NAME=mailman3 USER=mailman3 # Needed by click export LANG=en_US.UTF-8 # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # Load the VERBOSE setting and other rcS variables #. /lib/init/vars.sh # Define LSB log_* functions. # Depend on lsb-base (>= 3.2-14) to ensure that this file is present # and status_of_proc is working. #. /lib/lsb/init-functions case "$1" in start) [ "$VERBOSE" != no ] && echo "Starting $DESC" "$NAME" # use --force to remove a stale lock. /usr/local/bin/sudo -u $USER $DAEMON start --force ;; stop) [ "$VERBOSE" != no ] && echo "Stopping $DESC" "$NAME" /usr/local/bin/sudo -u $USER $DAEMON stop ;; status) /usr/local/bin/sudo -u $USER $DAEMON status ;; reopen) /usr/local/bin/sudo -u $USER $DAEMON reopen ;; restart) log_daemon_msg "Restarting $DESC" "$NAME" /usr/local/bin/sudo -u $USER $DAEMON restart ;; *) echo "Usage: $SCRIPTNAME {start|stop|status|reopen|restart}" >&2 exit 3 ;; esac Thank you. -- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)