I have the following problem: I make some automated changes in my webserver config (through a web interface) and I want to restart the apache. Since none of the actions are performed by root I cannot start the server directly.
My current workaround is to have a cronjob(every minute) for root that checks if a specific file exists (/tmp/restart.txt). If the file exists, it is deleted and the apache is restarted.
This can be invoked by other users by simply touching the file
$ touch /tmp/restart.txt
My question now is: Can I avoid the cronjob and somehow create a listener that gets invoked everytime the mtime of the file changes? This would be a better solution in my opinion.
-
cronjob doing this would be slightly more secure:
find /path/to/httpd.conf -newer /tmp/ars.dat -exec "/path/to/apache.rc restart;" -exec "touch -m /tmp/ars.dat;"
Putting the reference file somewhere other than tmp would probably be a good idea too.
From Chris S
0 comments:
Post a Comment