Initial commit

mostly as-is, taken from `rattail.fablib` subpackage
This commit is contained in:
Lance Edgar 2018-02-24 16:29:20 -06:00
commit 40dbb595e9
39 changed files with 3551 additions and 0 deletions

View file

@ -0,0 +1,6 @@
[apt]
frontend=none
email_address=root
confirm=0
save_seen=/var/lib/apt/listchanges.db
which=news

View file

@ -0,0 +1,142 @@
#!/bin/sh
# -*- coding: utf-8; -*-
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2018 Lance Edgar
#
# This file is part of Rattail.
#
# Rattail is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# Rattail. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
# This script is mostly based on the ``/etc/init.d/skeleton`` file from a
# Debian 6 system.
DESC=${DESC:-"Rattail Email Bouncer"}
NAME=${NAME:-"rattail-bouncer"}
SCRIPTNAME=${SCRIPTNAME:-"/etc/init.d/$NAME"}
PIDFILE=${PIDFILE:-"/var/run/rattail/$NAME.pid"}
PYTHON=${PYTHON:-"/usr/bin/python"}
RATTAIL=${RATTAIL:-"/usr/local/bin/rattail"}
RATTAIL_ARGS=${RATTAIL_ARGS:-""}
BOUNCER_ARGS=${BOUNCER_ARGS:-"--pidfile=$PIDFILE"}
USER=${USER:-"rattail"}
GROUP=${GROUP:-"rattail"}
# Read configuration variable files if present.
[ -r /etc/default/rattail ] && . /etc/default/rattail
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# 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
create_pid_dir() {
PIDDIR=`dirname "$PIDFILE"`
if [ ! -d "$PIDDIR" ]; then
mkdir --parents "$PIDDIR"
fi
chown $USER:$GROUP "$PIDDIR"
}
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
create_pid_dir
start-stop-daemon --start --pidfile $PIDFILE --exec $PYTHON --user $USER --test --quiet > /dev/null \
|| return 1
start-stop-daemon --start --pidfile $PIDFILE --exec $PYTHON --startas $RATTAIL --chuid $USER --group $GROUP --quiet -- \
$RATTAIL_ARGS bouncer $BOUNCER_ARGS start \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
sudo -u $USER $RATTAIL $RATTAIL_ARGS bouncer $BOUNCER_ARGS stop > /dev/null 2>&1
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View file

@ -0,0 +1,62 @@
#!/bin/sh
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2018 Lance Edgar
#
# This file is part of Rattail.
#
# Rattail is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# Rattail. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
#
# This is a simple script which will output a single line of info, and exit
# with a return code which indicates status of a given Rattail daemon. It was
# designed for use with Shinken monitoring. Invoke like so:
#
# check-rattail-daemon NAME
#
# Where NAME refers to the service, e.g. 'rattail-datasync'. Exit code may be:
#
# * 0 = daemon is confirmed running
# * 2 = daemon is confirmed *not* running
# * 3 = unknown state
#
################################################################################
NAME="$1"
if [ "$NAME" = "" ]; then
echo "Usage: check-rattail-daemon NAME"
exit 3
fi
PIDFILE="/var/run/rattail/$NAME.pid"
if [ ! -f "$PIDFILE" ]; then
echo "PID file not found: $PIDFILE"
exit 2
fi
PID=`cat $PIDFILE`
if [ "$PID" = "" ]; then
echo "File exists but contains no PID: $PIDFILE"
exit 3
fi
ps -p $PID >/dev/null
if [ ! $? ]; then
echo "No process found for PID $PID; per file: $PIDFILE"
exit 2
fi
echo "Rattail daemon $NAME is running with PID $PID"
exit 0

View file

@ -0,0 +1,17 @@
#!/bin/sh
EXPECTED_SIGNATURE=$(wget -q -O - https://composer.github.io/installer.sig)
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
ACTUAL_SIGNATURE=$(php -r "echo hash_file('SHA384', 'composer-setup.php');")
if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]
then
>&2 echo 'ERROR: Invalid installer signature'
rm composer-setup.php
exit 1
fi
php composer-setup.php --quiet
RESULT=$?
rm composer-setup.php
exit $RESULT

View file

@ -0,0 +1,148 @@
#!/bin/sh
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2018 Lance Edgar
#
# This file is part of Rattail.
#
# Rattail is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# Rattail. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
#
# Generic 'init' script for all Rattail daemons. Originally based on the
# skeleton file from a Debian 6 system, but tweaked plenty since...
#
# NOTE: The "calling" script *must* define $NAME and $DESC (at least).
#
################################################################################
# Files in /etc/default and/or the "calling" init script may define any of the
# following as necessary, to override:
SCRIPTNAME=${SCRIPTNAME:-"/etc/init.d/$NAME"}
PIDFILE=${PIDFILE:-"/var/run/rattail/$NAME.pid"}
PYTHON=${PYTHON:-"/usr/bin/python"}
RATTAIL=${RATTAIL:-"/usr/local/bin/rattail"}
RATTAIL_ARGS=${RATTAIL_ARGS:-""}
RATTAIL_SUBCMD=${RATTAIL_SUBCMD:-"${NAME##*-}"}
RATTAIL_SUBCMD_ARGS=${RATTAIL_SUBCMD_ARGS:-""}
USER=${USER:-"rattail"}
GROUP=${GROUP:-"rattail"}
# Read configuration variable files if present.
[ -r /etc/default/rattail ] && . /etc/default/rattail
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# 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
create_pid_dir() {
PIDDIR=`dirname "$PIDFILE"`
if [ ! -d "$PIDDIR" ]; then
mkdir --parents "$PIDDIR"
fi
chown $USER:$GROUP "$PIDDIR"
}
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
create_pid_dir
start-stop-daemon --start --pidfile "$PIDFILE" --exec "$PYTHON" --user $USER --test --quiet >/dev/null \
|| return 1
start-stop-daemon --start --pidfile "$PIDFILE" --exec "$PYTHON" --startas "$RATTAIL" --chuid $USER --group $GROUP --quiet -- \
$RATTAIL_ARGS $RATTAIL_SUBCMD --pidfile="$PIDFILE" $RATTAIL_SUBCMD_ARGS start \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
/usr/local/bin/check-rattail-daemon "$NAME" >/dev/null \
|| return 1
sudo -u $USER "$RATTAIL" $RATTAIL_ARGS $RATTAIL_SUBCMD --pidfile="$PIDFILE" $RATTAIL_SUBCMD_ARGS stop >/dev/null 2>&1 \
|| return 2
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
/usr/local/bin/check-rattail-daemon "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View file

@ -0,0 +1,142 @@
#!/bin/sh
# -*- coding: utf-8; -*-
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2018 Lance Edgar
#
# This file is part of Rattail.
#
# Rattail is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# Rattail. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
# This script is mostly based on the ``/etc/init.d/skeleton`` file from a
# Debian 6 system.
DESC=${DESC:-"Rattail Data Synchronizer"}
NAME=${NAME:-"rattail-datasync"}
SCRIPTNAME=${SCRIPTNAME:-"/etc/init.d/$NAME"}
PIDFILE=${PIDFILE:-"/var/run/rattail/$NAME.pid"}
PYTHON=${PYTHON:-"/usr/bin/python"}
RATTAIL=${RATTAIL:-"/usr/local/bin/rattail"}
RATTAIL_ARGS=${RATTAIL_ARGS:-""}
DATASYNC_ARGS=${DATASYNC_ARGS:-"--pidfile=$PIDFILE"}
USER=${USER:-"rattail"}
GROUP=${GROUP:-"rattail"}
# Read configuration variable files if present.
[ -r /etc/default/rattail ] && . /etc/default/rattail
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# 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
create_pid_dir() {
PIDDIR=`dirname "$PIDFILE"`
if [ ! -d "$PIDDIR" ]; then
mkdir --parents "$PIDDIR"
fi
chown $USER:$GROUP "$PIDDIR"
}
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
create_pid_dir
start-stop-daemon --start --pidfile $PIDFILE --exec $PYTHON --user $USER --test --quiet > /dev/null \
|| return 1
start-stop-daemon --start --pidfile $PIDFILE --exec $PYTHON --startas $RATTAIL --chuid $USER --group $GROUP --quiet -- \
$RATTAIL_ARGS datasync $DATASYNC_ARGS start \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
sudo -u $USER $RATTAIL $RATTAIL_ARGS datasync $DATASYNC_ARGS stop > /dev/null 2>&1
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View file

@ -0,0 +1,142 @@
#!/bin/sh
# -*- coding: utf-8; -*-
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2018 Lance Edgar
#
# This file is part of Rattail.
#
# Rattail is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# Rattail. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
# This script is mostly based on the ``/etc/init.d/skeleton`` file from a
# Debian 6 system.
DESC=${DESC:-"Rattail File Monitor"}
NAME=${NAME:-"rattail-filemon"}
SCRIPTNAME=${SCRIPTNAME:-"/etc/init.d/$NAME"}
PIDFILE=${PIDFILE:-"/var/run/rattail/$NAME.pid"}
PYTHON=${PYTHON:-"/usr/bin/python"}
RATTAIL=${RATTAIL:-"/usr/local/bin/rattail"}
RATTAIL_ARGS=${RATTAIL_ARGS:-""}
FILEMON_ARGS=${FILEMON_ARGS:-"--pidfile=$PIDFILE"}
USER=${USER:-"rattail"}
GROUP=${GROUP:-"rattail"}
# Read configuration variable files if present.
[ -r /etc/default/rattail ] && . /etc/default/rattail
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
# 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
create_pid_dir() {
PIDDIR=`dirname "$PIDFILE"`
if [ ! -d "$PIDDIR" ]; then
mkdir --parents "$PIDDIR"
fi
chown $USER:$GROUP "$PIDDIR"
}
#
# Function that starts the daemon/service
#
do_start()
{
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
create_pid_dir
start-stop-daemon --start --pidfile $PIDFILE --exec $PYTHON --user $USER --test --quiet > /dev/null \
|| return 1
start-stop-daemon --start --pidfile $PIDFILE --exec $PYTHON --startas $RATTAIL --chuid $USER --group $GROUP --quiet -- \
$RATTAIL_ARGS filemon $FILEMON_ARGS start \
|| return 2
}
#
# Function that stops the daemon/service
#
do_stop()
{
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
sudo -u $USER $RATTAIL $RATTAIL_ARGS filemon $FILEMON_ARGS stop > /dev/null 2>&1
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View file

@ -0,0 +1,126 @@
#!/bin/sh
# -*- coding: utf-8; -*-
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2018 Lance Edgar
#
# This file is part of Rattail.
#
# Rattail is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# Rattail. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
#
# Generic 'init' script for Luigi central scheduler (luigid)
#
################################################################################
# "calling" init script may define any of the following as necessary:
NAME=${NAME:-"rattail-luigid"}
SCRIPTNAME=${SCRIPTNAME:-"/etc/init.d/$NAME"}
DESC=${DESC:-"Luigi Scheduler for Rattail"}
DAEMON=${DAEMON:-"/usr/local/bin/luigid"}
USER=${USER:-"rattail"}
GROUP=${GROUP:-"rattail"}
PIDFILE=${PIDFILE:-"/var/run/rattail/$NAME.pid"}
LOGDIR=${LOGDIR:-"/var/log/rattail/$NAME"}
STATEFILE=${STATEFILE:-"/var/run/rattail/$NAME.pickle"}
ADDRESS=${ADDRESS:-"0.0.0.0"}
create_pid_dir() {
PIDDIR=`dirname "$PIDFILE"`
if [ ! -d "$PIDDIR" ]; then
mkdir --parents "$PIDDIR"
fi
chown $USER:$GROUP "$PIDDIR"
}
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
do_start() {
create_pid_dir
start-stop-daemon --test --start --exec $DAEMON --user $USER --pidfile $PIDFILE --quiet > /dev/null \
|| return 1
start-stop-daemon --start --chuid $USER --exec $DAEMON --pidfile $PIDFILE --background --quiet -- \
--background --pidfile $PIDFILE --logdir $LOGDIR --state-path $STATEFILE --address $ADDRESS \
|| return 2
}
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
do_stop()
{
start-stop-daemon --test --stop --exec $DAEMON --user $USER --pidfile $PIDFILE --quiet > /dev/null \
|| return 1
start-stop-daemon --stop --exec $DAEMON --user $USER --pidfile $PIDFILE --quiet > /dev/null \
|| return 2
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
/usr/local/bin/check-rattail-daemon "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View file

@ -0,0 +1,4 @@
mysql-server-5.5 mysql-server/root_password password ${password}
mysql-server-5.5 mysql-server/root_password seen true
mysql-server-5.5 mysql-server/root_password_again password ${password}
mysql-server-5.5 mysql-server/root_password_again seen true

View file

@ -0,0 +1,16 @@
[mysql]
user = root
password = ${password}
[mysqladmin]
user = root
password = ${password}
[mysqldump]
user = root
password = ${password}
[mysqlshow]
user = root
password = ${password}

View file

@ -0,0 +1,5 @@
define command{
command_name check_rattail_daemon
command_line $PLUGINSDIR$/check_by_ssh -H $HOSTADDRESS$ -C "check-rattail-daemon $ARG1$" --logname=rattail
}

View file

@ -0,0 +1,5 @@
{
"name": "rattail",
"description": "Can check various Rattail daemons to ensure they're running. Performs checks using SSH.",
"path": "software/"
}

View file

@ -0,0 +1,6 @@
define host{
name rattail
use linux
register 0
}

View file

@ -0,0 +1,125 @@
#!/bin/sh
# -*- coding: utf-8; -*-
################################################################################
#
# Rattail -- Retail Software Framework
# Copyright © 2010-2018 Lance Edgar
#
# This file is part of Rattail.
#
# Rattail is free software: you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation, either version 3 of the License, or (at your option) any later
# version.
#
# Rattail is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# Rattail. If not, see <http://www.gnu.org/licenses/>.
#
################################################################################
#
# Generic 'init' script for headless LibreOffice Writer
#
################################################################################
# "calling" init script may define any of the following as necessary:
NAME=${NAME:-"rattail-soffice"}
SCRIPTNAME=${SCRIPTNAME:-"/etc/init.d/$NAME"}
DESC=${DESC:-"LibreOffice for Rattail"}
DAEMON=${DAEMON:-"/usr/lib/libreoffice/program/soffice.bin"}
SOFFICE=${SOFFICE:-"/usr/bin/soffice"}
USER=${USER:-"rattail"}
GROUP=${GROUP:-"rattail"}
PIDFILE=${PIDFILE:-"/var/run/rattail/$NAME.pid"}
PORT=${PORT:-"2002"}
create_pid_dir() {
PIDDIR=`dirname "$PIDFILE"`
if [ ! -d "$PIDDIR" ]; then
mkdir --parents "$PIDDIR"
fi
chown $USER:$GROUP "$PIDDIR"
}
# Return
# 0 if daemon has been started
# 1 if daemon was already running
# 2 if daemon could not be started
do_start() {
create_pid_dir
start-stop-daemon --test --start --exec $DAEMON --user $USER --pidfile $PIDFILE --quiet > /dev/null \
|| return 1
start-stop-daemon --start --chuid $USER --exec $DAEMON --startas $SOFFICE --pidfile $PIDFILE --background --quiet -- \
--headless --pidfile=$PIDFILE --accept="socket,host=localhost,port=$PORT;urp;" \
|| return 2
}
# Return
# 0 if daemon has been stopped
# 1 if daemon was already stopped
# 2 if daemon could not be stopped
# other if a failure occurred
do_stop()
{
start-stop-daemon --test --stop --exec $DAEMON --user $USER --pidfile $PIDFILE --quiet > /dev/null \
|| return 1
start-stop-daemon --stop --exec $DAEMON --user $USER --pidfile $PIDFILE --quiet > /dev/null \
|| return 2
}
case "$1" in
start)
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
do_start
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
stop)
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
do_stop
case "$?" in
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
esac
;;
status)
/usr/local/bin/check-rattail-daemon "$NAME" && exit 0 || exit $?
;;
restart|force-reload)
log_daemon_msg "Restarting $DESC" "$NAME"
do_stop
case "$?" in
0|1)
do_start
case "$?" in
0) log_end_msg 0 ;;
1) log_end_msg 1 ;; # Old process is still running
*) log_end_msg 1 ;; # Failed to start
esac
;;
*)
# Failed to stop
log_end_msg 1
;;
esac
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
exit 3
;;
esac
:

View file

@ -0,0 +1,4 @@
# -*- mode: conf; -*-
# let rattail upgrade itself
rattail ALL = NOPASSWD: /srv/envs/*/app/upgrade*.sh *