我正在尝试在 Ubuntu 20.04 上运行脚本但出现错误:
usermac: command not found
usercaps: command not found
我的脚本:
check_user_db(){
info_log -m -t "user $PGUSER"
id $PGUSER >/dev/null 2> /dev/null || {
info_log -m -m -t "create user $PGUSER"
useradd $PGUSER
}
usermac -m ${VAL_MIN}:${VAL_MAX} -c 0:0 $PGUSER > /dev/null
usermac $PGUSER | grep level | while read STR; do info_log -m -m -t $STR; done
usercaps -z $PGUSER > /dev/null
if [ -z "$(su -l postgres -c "psql -t -c '\du $PGUSER'" 2>/dev/null | grep "$PGUSER ")" ];then
info_log -m -m -t "Create db user $PGUSER"
su -l postgres -c "psql -c 'create role $PGUSER login INHERIT CREATEDB'" >> $LOGFILE 2>&1 || fail -t "error: user ($PGUSER)"
su -l postgres -c "psql -c \"alter role $PGUSER with password '$PGPASSWD';\"" >> $LOGFILE 2>&1 || fail -t "error: user ($PGUSER)"
fi
}
您知道问题是什么以及如何解决它吗?