From: Valentin Vidic Date: Fri, 28 Dec 2007 16:39:43 +0000 (+0100) Subject: Updated service checks. Use unique debconf names. X-Git-Tag: debian/4.0.1~86 X-Git-Url: http://ftp.carnet.hr/pub/carnet-debian/scm?a=commitdiff_plain;h=146551dcb7e1ac36c8722d6cb508800bb9b5b2da;p=carnet-upgrade.git Updated service checks. Use unique debconf names. --- diff --git a/usr/share/carnet-upgrade/data.sh b/usr/share/carnet-upgrade/data.sh index f00c6d6..c8d85a6 100644 --- a/usr/share/carnet-upgrade/data.sh +++ b/usr/share/carnet-upgrade/data.sh @@ -84,8 +84,7 @@ Nessus nessus-cn nessus nessusd # Check if these services are running after upgrade # package-cn user proces (pazi, regexp) nice name services_to_check=' -amavisd-cn amavis amavisd \(master\) Amavis -amavisd-new-milter amavis /usr/sbin/amavis-milter Amavis-milter +amavisd-cn amavis amavisd [(]master[)] Amavis aosi-aai aosi /usr/sbin/aosi AOSI apache-cn www-data /usr/sbin/apache Apache bind9-cn bind /usr/sbin/named Bind @@ -102,10 +101,9 @@ postfix-cn postgrey /usr/sbin/postgrey Postfix greylisting postfix-cn root /usr/lib/postfix/master Postfix postfix-cn root /usr/sbin/saslauthd SASL authentication postgresql-cn postgres /usr/lib/postgresql/bin/postmaster PostgreSQL -proftpd-cn nobody proftpd: \(accepting connections\) ProFTPD (mozda se pokrece iz (x)inetd-a) +proftpd-cn nobody proftpd: [(]accepting connections[)] ProFTPD (mozda se pokrece iz (x)inetd-a) samba-cn root /usr/sbin/smbd Samba -spamassassin-cn root /usr/sbin/dccifd DCC client -spamassassin-cn root /usr/sbin/spamd SpamAssassin +spamassassin-cn dcc /usr/sbin/dccifd DCC client vsftpd-cn root /usr/sbin/vsftpd VSFTPD xinetd-cn root /usr/sbin/xinetd xinetd ' diff --git a/usr/share/carnet-upgrade/scripts/check_services b/usr/share/carnet-upgrade/scripts/check_services index 7677ffc..aa24d6f 100755 --- a/usr/share/carnet-upgrade/scripts/check_services +++ b/usr/share/carnet-upgrade/scripts/check_services @@ -26,11 +26,30 @@ cs_preupgrade () { done if [ -n "$services" ]; then - db_set cn-upgrade/check-services "$services" + db_set cn3-upgrade/check-services "$services" db_go || true fi } +cs_pgrep () { + local failed_services + + while read line; do + # get service param from stdin + user=$(echo "$line" | awk -F ' ' '{print $2}') + psname=$(echo "$line" | awk -F ' ' '{print $3}') + nicename=$(echo "$line" | awk -F ' ' '{print $4}') + + # check if service is running + if ! pgrep -u $user -f "$psname" > /dev/null; then + failed_services="$failed_services, $nicename" + + fi + done + + echo ${failed_services#, } +} + # uzmi iz debconfa instalirane servise, i provjeri rade li cs_postupgrade () { local services i failed_services msg_header @@ -43,21 +62,15 @@ cs_postupgrade () { ;; esac - db_get cn-upgrade/check-services || true - services="$RET" - - for i in $(echo "$services"); do - user=$(echo "$services_to_check" | grep ^${i} | sed 's/ */ /g'| awk -F' ' '{print $2}') - psname=$(echo "$services_to_check" | grep ^${i} | sed 's/ */ /g'| awk -F' ' '{print $3}') - nicename=$(echo "$services_to_check" | grep ^${i} | sed 's/ */ /g'| awk -F' ' '{print $4}') - if ! pgrep -u $user -f "$psname" > /dev/null; then - if [ -z "$failed_services" ]; then - failed_services="$nicename" - else - failed_services="$failed_services, $nicename" - fi - fi - done + db_get cn3-upgrade/check-services || true + services="${RET// /|}" + + failed_services=$( + echo "$services_to_check" \ + | grep -E "^($services)" \ + | sed 's/ */ /g' \ + | cs_pgrep + ) if [ -n "$failed_services" ]; then notice "$msg_header$msg_failed_services$failed_services" @@ -68,7 +81,7 @@ cs_postupgrade () { # checkiraj da li je sto zapisano u debconf cs_check () { - db_get cn-upgrade/check-services || true + db_get cn3-upgrade/check-services || true debconf="$RET" if [ -n "$debconf" ]; then diff --git a/usr/share/carnet-upgrade/scripts/debconf_priority b/usr/share/carnet-upgrade/scripts/debconf_priority index 028b445..7b330c4 100755 --- a/usr/share/carnet-upgrade/scripts/debconf_priority +++ b/usr/share/carnet-upgrade/scripts/debconf_priority @@ -15,7 +15,7 @@ debconf_priority_preupgrade () { old_debconf="$RET" if [ -n "$old_debconf" ]; then - db_set cn-upgrade/debconf-priority "$old_debconf" + db_set cn3-upgrade/debconf-priority "$old_debconf" fi db_set debconf/priority high @@ -27,12 +27,12 @@ debconf_priority_preupgrade () { debconf_priority_postupgrade () { local new_debconf - db_get cn-upgrade/debconf-priority || true + db_get cn3-upgrade/debconf-priority || true new_debconf="$RET" if [ -n "$new_debconf" ]; then db_set debconf/priority "$new_debconf" - db_set cn-upgrade/debconf-priority "" + db_set cn3-upgrade/debconf-priority "" fi db_go || true @@ -40,7 +40,7 @@ debconf_priority_postupgrade () { # checkiraj debconf_priority_check () { - db_get cn-upgrade/debconf-priority || true + db_get cn3-upgrade/debconf-priority || true debconf="$RET" if [ -n "$debconf" ]; then