Subject: Re: Starting Apache/MySql
From: Andrew Diller (dillera@falstaff.isc-net.upenn.edu)
Date: Wed Sep 20 2000 - 14:19:54 MDT
On Wed, Sep 20, 2000 at 01:40:30PM -0500, Gawain Reifsnyder wrote:
>
> I want to have Apache/MySQL launch at startup. I know it's basically
> a very simple thing, and I need to create or edit a script to do
> this, but the documentation on both packages is very sketchy on
-------------use-this-- change the PATH's as needed!
#!/bin/sh
# Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB
# This file is public domain and comes with NO WARRANTY of any kind
# Mysql deamon start/stop script.
# Usually this is put in /etc/init.d (at least on machines SYSV R4
# based systems) and linked to /etc/rc3.d/S99mysql. When this is done
# the mysql server will be started when the machine is started.
PATH=/sbin:/usr/bin:/usr/sbin:/bin:/usr/local/bin
basedir=/usr/local
bindir=/usr/local/bin
mysql_root_user=RXXXXX # In the mysql 'user' table this user has shutdown priv.
mysql_root_pwd= # The password for the mysql_root_user.
mysql_daemon_user=XXXXXXXX # Run mysqld as this user. Should be 'mysql'
# If you use this, uncomment one of the su rows below
export PATH
mode=$1
# Safeguard (relative paths, core dumps..)
cd $basedir
case "$mode" in
'start')
# Start deamon
if test -x $bindir/safe_mysqld
then
# -l means start with log.
# su -c -- $mysql_daemon_user $bindir/safe_mysqld -l & # For Linux
# su $mysql_daemon_user $bindir/safe_mysqld -l & # For sun
# $bindir/safe_mysqld -l &
mode=$1
# Safeguard (relative paths, core dumps..)
cd $basedir
case "$mode" in
'start')
# Start deamon
if test -x $bindir/safe_mysqld
then
# -l means start with log.
# su -c -- $mysql_daemon_user $bindir/safe_mysqld -l & # For Linux
# su $mysql_daemon_user $bindir/safe_mysqld -l & # For sun
# $bindir/safe_mysqld -l &
nohup sudo -u $mysql_daemon_user $bindir/safe_mysqld --skip-networking \
2>&1 | logger -p daemon.notice -t mysql.server &
else
echo "Can't execute $bindir/safe_mysqld"
fi
;;
'stop')
# Stop deamon
sudo -u $mysql_root_user $bindir/mysqladmin -u $mysql_root_user \
--password=$mysql_root_pwd shutdown
;;
*)
# usage
echo "usage: $0 start|stop"
exit 1
;;
esac
-end--------------------cut-here------------``
-andy diller
This archive was generated by hypermail 2a24 : Wed Sep 20 2000 - 14:26:16 MDT