#!/bin/sh
# CentOS 4 services
#
# Stops unnecessary services and starts necessary services
# Configures php.ini and inittab
# Makes symlink for krb5 com_err.h
#
# Nick Hemmesch <nick@ndhsoft.com>
# June 6, 2005
#

# Set mysql password
MYSQLPW=your-mysql-password
 
chkconfig apmd off
service apmd stop

chkconfig atd off
service atd stop

chkconfig autofs off
service autofs stop

chkconfig cups off
service cups stop

chkconfig cups-config-daemon off
service cups-config-daemon stop

chkconfig gpm off
service gpm stop

chkconfig isdn off
service isdn stop

chkconfig mdmonitor off
service mdmonitor stop

chkconfig netfs off
service netfs stop

chkconfig nfslock off
service nfslock stop

chkconfig pcmcia off
service pcmcia stop

chkconfig portmap off
service portmap stop

chkconfig rawdevices off
service rawdevices stop

chkconfig rhnsd off
service rhnsd stop

chkconfig sendmail off
service sendmail stop

chkconfig httpd on
service httpd start

chkconfig mysqld on
service mysqld start



# Setup mysql for vpopmail
##########################

# Setup root account

mysqladmin -uroot password $MYSQLPW
mysqladmin -uroot -p$MYSQLPW reload
mysqladmin -uroot -p$MYSQLPW refresh

# Create vpopmaildatabase with correct permissions

mysqladmin create vpopmail -uroot -p$MYSQLPW
mysqladmin -uroot -p$MYSQLPW reload
mysqladmin -uroot -p$MYSQLPW refresh

echo "GRANT ALL PRIVILEGES ON vpopmail.* TO vpopmail@localhost IDENTIFIED BY 'SsEeCcRrEeTt'" | mysql -uroot -p$MYSQLPW
mysqladmin -uroot -p$MYSQLPW reload
mysqladmin -uroot -p$MYSQLPW refresh


# Set php.ini register_globals =On

cp -u /etc/php.ini /etc/php.ini.bak
cat /etc/php.ini | sed -e 's/^register_globals = Off/register_globals = On/' > /etc/php.ini.new
mv -f /etc/php.ini.new /etc/php.ini


# Set to boot to runlevel 3

cp -u /etc/inittab /etc/inittab.bak
cat /etc/inittab | sed -e 's/^id:5:initdefault:/id:3:initdefault:/' > /etc/inittab.new
mv -f /etc/inittab.new /etc/inittab


# Make krb5 symlink

ln -s /usr/include/et/com_err.h /usr/include/com_err.h


# Setup for firewall

sh firewall.sh

