#!/usr/bin/bash
#
# aoserv-mrtg - MRTG configured by the AOServ Platform.
# Copyright (C) 2018, 2025  AO Industries, Inc.
#     support@aoindustries.com
#     7262 Bull Pen Cir
#     Mobile, AL 36695
#
# This file is part of aoserv-mrtg.
#
# aoserv-mrtg is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# aoserv-mrtg 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with aoserv-mrtg.  If not, see <http://www.gnu.org/licenses/>.
#

if [ -z "$1" ]
then
  service='httpd'
else
  service="httpd@$1"
fi
childProcesses="$(
  ps --ppid "$(cat "/run/$service/httpd.pid")" --no-headers -o args \
    | grep '^/usr/sbin/httpd ' \
    | wc -l
)"
let concurrency="$childProcesses * $2"
echo "$concurrency"
echo "$concurrency"
echo "1"
echo "Workers\n"
