Mercurial > pub > site.implab
view serve.pl @ 3:84ed27230825
sync
author | sergey |
---|---|
date | Thu, 08 May 2014 03:54:38 +0400 |
parents | aac1085b256d |
children |
line wrap: on
line source
#!/usr/bin/perl use strict; use warnings; use POSIX qw(setsid); my ($pidApache,$pidMysql,$pidTailf); print "starting apache\n"; unless($pidApache = fork()) { setsid(); exec('/usr/sbin/httpd2 -d . -f httpd.conf -DNO_DETACH -DFOREGROUND'); } print "starting mysql\n"; unless($pidMysql = fork()) { #setsid(); open STDERR, '>mysql.log'; open STDOUT, '>mysql.log'; exec('/usr/sbin/mysqld --defaults-file=./my.cnf'); } print "press any key to stop\n"; print "opening apache log\n"; unless($pidTailf = fork()) { #setsid(); exec('/usr/bin/tailf httpd.log'); } getc; print "SHUTDOWN\n"; print "shutdown apache ($pidApache)\n"; kill 28, $pidApache; waitpid $pidApache, 0; print "apache exited\n"; print "shutdown mysql ($pidMysql)\n"; kill 15, $pidMysql; waitpid $pidMysql, 0; print "mysql exited\n"; print "closing log ($pidTailf)\n"; kill 9, $pidTailf; waitpid $pidTailf, 0; print "done\n"; exit;