creating a startup script for a foreign application
Odhiambo Washington
odhiambo at gmail.com
Sat Aug 22 07:11:25 UTC 2020
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.
<BEGIN>
#!/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
<END>
Thank you.
--
Best regards,
Odhiambo WASHINGTON,
Nairobi,KE
+254 7 3200 0004/+254 7 2274 3223
"Oh, the cruft.", grep ^[^#] :-)
More information about the freebsd-questions
mailing list