Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Mar 2002 14:27:55 -0500
From:      Jon Ringuette <wintermute@imeme.net>
To:        joe@jwebmedia.com, questions@freebsd.org
Subject:   Re: restart jailed apache from host machine
Message-ID:  <3C8E56BB.50405@imeme.net>
References:  <3C8E231F.7AA654CF@jwebmedia.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Joseph Koenig wrote:

>Is there a way to restart a jailed apache from the host machine - by
>host, I mean the physical machine that the jail is installed on. I have
>3 jails and need to restart each of their apache processes when I have
>processed their log files. The log files are processed by a script on
>the main machine. Any ideas? I tried using the full path
>(/usr/jail/xx.xx.xx.xx/usr/local/sbin/apachectl), but that didn't work. Thanks,
>
You are going to need something that will run inside the jails own 
process stack.  If you run it from the main system you are going to 
orphan the process and it will be running outside the jail (eliminiating 
the point of the jail <g>)  And it will also not be visable to the jail 
anymore as well.  The easiest way i've found is to use cron.  Setup a 
cron tab that reads every 5min. and exectures using the periodic script 
all the files in a directory every 5min.  You will also want to throw in 
something like 999.cleanup which will delete once run all the files in 
that directory this code will do that nicly:

#!/usr/local/bin/bash


for i in $( ls /etc/periodic/imeme); do   
     if [ "$i" != "999.cleanup" ]; then
             rm /etc/periodic/imeme/$i
     fi
done
 
and of course you will need to change /etc/periodic/imeme to whatever 
directory it is you use.

But now you can throw bash files into this directory and have the 
execute ONCE and then be destroyed then all you need is

#!/usr/local/bin/bash
/usr/local/sbin/apachectl restart



-jon
iMeme



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3C8E56BB.50405>