# 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
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
'
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
;;
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"
# 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
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
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
# checkiraj
debconf_priority_check () {
- db_get cn-upgrade/debconf-priority || true
+ db_get cn3-upgrade/debconf-priority || true
debconf="$RET"
if [ -n "$debconf" ]; then