#to initially set up daemons on a system:
# running as root:
#
# Copyright (c) 2019 Clementine Computing LLC.
# 
# This file is part of PopuFare.
# 
# PopuFare is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# PopuFare 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 Affero General Public License for more details.
# 
# You should have received a copy of the GNU Affero General Public License
# along with PopuFare.  If not, see <https://www.gnu.org/licenses/>.
#

cp ../server_scripts/RideLogic.pm /usr/lib/perl/5.8.8/

mkdir /var/run/ridelogic
chown bus:bus /var/run/ridelogic

mkdir /var/log/ridelogic
chown bus:bus /var/log/ridelogic

mkdir /etc/ridelogic
cp /home/bus/new_bus/devel/server_daemons/etc/ridelogic/* /etc/ridelogic
cp /home/bus/new_bus/devel/server_daemons/etc/init.d/* /etc/init.d

cp /home/bus/new_bus/devel/server_daemons/avls_server/ridelogic_avlsd /usr/bin
cp /home/bus/new_bus/devel/server_daemons/billing_server/ridelogic_billingd /usr/bin
cp /home/bus/new_bus/devel/server_daemons/buspass_server/ridelogic_buspassd /usr/bin
cp /home/bus/new_bus/devel/server_daemons/hello_daemon/ridelogic_hellod /usr/bin
cp /home/bus/new_bus/devel/server_daemons/version_server/ridelogic_versiond /usr/bin

chkconfig --add ridelogic_avlsd
chkconfig --add ridelogic_billingd
chkconfig --add ridelogic_buspassd
chkconfig --add ridelogic_hellod
chkconfig --add ridelogic_versiond

chkconfig --level 3 ridelogic_avlsd on
chkconfig --level 3 ridelogic_billingd on
chkconfig --level 3 ridelogic_buspassd on
chkconfig --level 3 ridelogic_hellod on
chkconfig --level 3 ridelogic_versiond on

# chkconfig --list | grep ridelogic


