From mboxrd@z Thu Jan 1 00:00:00 1970 From: mgrac@sourceware.org Date: 4 Oct 2006 18:04:35 -0000 Subject: [Cluster-devel] cluster/rgmanager/src/resources apache.sh open ... Message-ID: <20061004180435.29201.qmail@sourceware.org> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit CVSROOT: /cvs/cluster Module name: cluster Changes by: mgrac at sourceware.org 2006-10-04 18:04:32 Modified files: rgmanager/src/resources: apache.sh openldap.sh postgres-8.sh samba.sh rgmanager/src/resources/utils: config-utils.sh Log message: This patch pushes generated configuration files for service in /etc/cluster/ (RA_COMMON_conf_dir) where each service (samba, openldap, ...) has it's own directory. In this directory is another directory with instances (OCF_RESOURCE_INSTANCE). Our generated configuration files are not re-generated when user changes them, that' reason why there are in /etc and not in /var. Patches: http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/apache.sh.diff?cvsroot=cluster&r1=1.8&r2=1.9 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/openldap.sh.diff?cvsroot=cluster&r1=1.6&r2=1.7 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/postgres-8.sh.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/samba.sh.diff?cvsroot=cluster&r1=1.4&r2=1.5 http://sourceware.org/cgi-bin/cvsweb.cgi/cluster/rgmanager/src/resources/utils/config-utils.sh.diff?cvsroot=cluster&r1=1.4&r2=1.5 --- cluster/rgmanager/src/resources/apache.sh 2006/09/29 11:35:16 1.8 +++ cluster/rgmanager/src/resources/apache.sh 2006/10/04 18:04:32 1.9 @@ -33,9 +33,10 @@ . $(dirname $0)/utils/ra-skelet.sh declare APACHE_HTTPD=/usr/sbin/httpd -declare APACHE_genConfig="/tmp/httpd.$OCF_RESKEY_name" declare APACHE_serverConfigFile declare APACHE_pid_file="`generate_name_for_pid_file`" +declare APACHE_conf_dir="`generate_name_for_conf_dir`" +declare APACHE_genConfig="$APACHE_conf_dir/httpd.conf" declare APACHE_parseConfig=$(dirname $0)/utils/httpd-parse-config.pl @@ -162,6 +163,7 @@ clog_service_start $CLOG_INIT create_pid_directory + create_conf_directory "$APACHE_conf_dir" check_pid_file "$APACHE_pid_file" if [ $? -ne 0 ]; then --- cluster/rgmanager/src/resources/openldap.sh 2006/09/29 11:35:16 1.6 +++ cluster/rgmanager/src/resources/openldap.sh 2006/10/04 18:04:32 1.7 @@ -34,7 +34,8 @@ declare LDAP_SLAPD=/usr/sbin/slapd declare LDAP_pid_file="`generate_name_for_pid_file`" -declare LDAP_gen_config_file="/tmp/openldap.$OCF_RESKEY_name" +declare LDAP_conf_dir="`generate_name_for_conf_dir`" +declare LDAP_gen_config_file="$LDAP_conf_dir/slapd.conf" declare LDAP_url_list verify_all() @@ -127,6 +128,7 @@ clog_service_start $CLOG_INIT create_pid_directory + create_conf_directory "$LDAP_conf_dir" check_pid_file "$LDAP_pid_file" if [ $? -ne 0 ]; then --- cluster/rgmanager/src/resources/postgres-8.sh 2006/09/29 11:35:16 1.4 +++ cluster/rgmanager/src/resources/postgres-8.sh 2006/10/04 18:04:32 1.5 @@ -34,7 +34,8 @@ declare PSQL_POSTMASTER="/usr/bin/postmaster" declare PSQL_pid_file="`generate_name_for_pid_file`" -declare PSQL_gen_config_file="/tmp/postgresql.$OCF_RESKEY_name" +declare PSQL_conf_dir="`generate_name_for_conf_dir`" +declare PSQL_gen_config_file="$PSQL_conf_dir/postgresql.conf" verify_all() { @@ -120,6 +121,7 @@ clog_service_start $CLOG_INIT create_pid_directory + create_conf_directory "$PSQL_conf_dir" check_pid_file "$PSQL_pid_file" if [ $? -ne 0 ]; then --- cluster/rgmanager/src/resources/samba.sh 2006/09/29 11:35:16 1.4 +++ cluster/rgmanager/src/resources/samba.sh 2006/10/04 18:04:32 1.5 @@ -35,9 +35,10 @@ declare SAMBA_SMBD=/usr/sbin/smbd declare SAMBA_NMBD=/usr/sbin/nmbd declare SAMBA_pid_dir="`generate_name_for_pid_dir`" +declare SAMBA_conf_dir="`generate_name_for_conf_dir`" declare SAMBA_smbd_pid_file="$SAMBA_pid_dir/smbd.pid" declare SAMBA_nmbd_pid_file="$SAMBA_pid_dir/nmbd.pid" -declare SAMBA_gen_config_file="/tmp/samba.$OCF_RESKEY_name" +declare SAMBA_gen_config_file="$SAMBA_conf_dir/smb.conf" verify_all() { @@ -110,6 +111,7 @@ create_pid_directory mkdir -p "$SAMBA_pid_dir" + create_conf_directory "$SAMBA_conf_dir" check_pid_file "$SAMBA_smbd_pid_file" if [ $? -ne 0 ]; then --- cluster/rgmanager/src/resources/utils/config-utils.sh 2006/09/29 11:35:16 1.4 +++ cluster/rgmanager/src/resources/utils/config-utils.sh 2006/10/04 18:04:32 1.5 @@ -20,6 +20,7 @@ # declare RA_COMMON_pid_dir=/var/run/cluster +declare RA_COMMON_conf_dir=/etc/cluster declare -i FAIL=-1 declare -a ip_keys @@ -234,6 +235,14 @@ return 0; } +generate_name_for_conf_dir() +{ + declare filename=$(basename $0) + + echo "$RA_COMMON_conf_dir/$(basename $0 | sed 's/^\(.*\)\..*/\1/')/$OCF_RESOURCE_INSTANCE" + + return 0; +} create_pid_directory() { @@ -254,6 +263,19 @@ return 0; } +create_conf_directory() +{ + declare dirname="$1" + + if [ -d "$dirname" ]; then + return 0; + fi + + mkdir -p "$dirname" + + return 0; +} + check_pid_file() { declare pid_file="$1"