From: intrigeri Date: Sun, 2 Oct 2005 17:35:22 +0000 (+0000) Subject: r188@krups: intrigeri | 2005-10-03 01:14:37 +0200 X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=e51747517197ac752d838226e4fa1528c6857408;p=matthijs%2Fupstream%2Fbackupninja.git r188@krups: intrigeri | 2005-10-03 01:14:37 +0200 Replaced awful "grep /etc/passwd" with getent calls in pgsql and mysql handlers git-svn-id: http://code.autistici.org/svn/backupninja/trunk@185 758a04ac-41e6-0310-8a23-8373a73cc35d --- diff --git a/handlers/mysql b/handlers/mysql index 57b9ecf..4ac631b 100644 --- a/handlers/mysql +++ b/handlers/mysql @@ -22,7 +22,7 @@ if [ "$user" == "" ]; then user=root; else userset=true; - userhome=`grep "^$user:" /etc/passwd | awk -F: '{print $6}'` + userhome=`getent passwd "$user" | awk -F: '{print $6}'` [ -f $userhome/.my.cnf ] || fatal "Can't find config file in $userhome/.my.cnf" fi diff --git a/handlers/pgsql b/handlers/pgsql index 11a5cfe..c17caf8 100644 --- a/handlers/pgsql +++ b/handlers/pgsql @@ -58,7 +58,7 @@ fi # give backup dir the good uid and permissions # (in respect to the vserver, if $usevserver) -pguid=`grep '^postgres:' $vroot/etc/passwd | awk -F: '{print $3}'` +pguid=`getent passwd postgres | awk -F: '{print $3}'` [ -n "$pguid" ] || \ fatal "No user called postgres`[ $usevserver != 1 ] || echo \" on vserver $vsname\"`." debug "chown $pguid $vroot$backupdir"