[lug] Newbie question

John Hernandez John.Hernandez at noaa.gov
Thu Jul 12 11:20:32 MDT 2001


Kirk Ellsworth wrote:
> 
> I want to start and stop postgresql, apache, and sendmail at the same
> time with ease.  How could I put this into a script and name the script
> "horde services stop".
> 

What you probably want is a script /etc/rc.d/init.d/horde which contains something like:

#!/bin/bash
case "$1" in
  start)
	service sendmail start || /etc/rc.d/init.d/sendmail start
	service apache start || /etc/rc.d/init.d/apache start
	service postgrsql start || /etc/rc.d/init.d/postgresql start
        ;;
  stop)
	service sendmail stop || /etc/rc.d/init.d/sendmail stop
	service apache stop || /etc/rc.d/init.d/apache stop
	service postgrsql stop || /etc/rc.d/init.d/postgresql stop
        ;;

I don't know if your distro supports the "service" and "chkconfig" method of sys-v initialization.  If not, you will probably fall back to use the form after the || in each line.  If it does, you should be able to register "horde" with chkconfig by putting some appropriate comments at the top of your file and running 'chkconfig --add'.  See chkconfig(8).  Be sure this doesn't start at any run level (ie. don't link it into /etc/rc.d/rc?.d/) but rather it should be run manually directly from /etc/rc.d/init.d or via "service".

> Also how do I run a .sql file?  I also need to attach a "\i" to the
> command???
>

I'll defer to someone else on this part.
 
> Kirk
> _______________________________________________
> Web Page:  http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug

-- 

  - John Hernandez - Network Engineer - 303-497-6392 -
 |  National Oceanic and Atmospheric Administration   |
 |  Mailstop R/OM12. 325 Broadway, Boulder, CO 80305  |
  ----------------------------------------------------



More information about the LUG mailing list