Date: Sat, 25 Jul 2020 22:59:59 +0300 From: Odhiambo Washington <odhiambo@gmail.com> To: questions <questions@freebsd.org> Subject: Help adapting a Linux init script to FreeBSD-12 Message-ID: <CAAdA2WPkLoo17FgRFzKb81e5uRn-GQ2GJamp=JvLFGs46Q6QEQ@mail.gmail.com>
next in thread | raw e-mail | index | archive | help
Hello everyone, I'm wondering if someone would be willing to assist me adapt a Linux init script to conform with FreeBSD-12 so that I can control Mailman3 that I have installed. I was thinking of relying on the one for mailman (2.1.x), but things seem a little different. So far this script below can start|stop mailman3 without a problem, but I'd like a situation where it can do the same across reboots. Please let me know what you think: <cut> root@gw:/opt/mailman/mm # less /usr/local/etc/rc.d/mailman3 ### 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=mailman USER=mailman3 GROUP=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 </cut> Thanks in advance for your input. -- Best regards, Odhiambo WASHINGTON, Nairobi,KE +254 7 3200 0004/+254 7 2274 3223 "Oh, the cruft.", grep ^[^#] :-)
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAAdA2WPkLoo17FgRFzKb81e5uRn-GQ2GJamp=JvLFGs46Q6QEQ>