#! /bin/bash
dir=/home/mysql
for file in `ls $dir`; do
for file2 in `ls $dir/$file` ; do
own=`ls -ld $dir/$file/$file2 |awk '{print $3}'`
if [ "$own" -ne "root" ] ; then
chown -R mysql:mysql $dir/$file/$file2
echo "$dir/$file/$file2" >>/tmp/checkown.log
fi
done
done
dir=/home/mysql
for file in `ls $dir`; do
for file2 in `ls $dir/$file` ; do
own=`ls -ld $dir/$file/$file2 |awk '{print $3}'`
if [ "$own" -ne "root" ] ; then
chown -R mysql:mysql $dir/$file/$file2
echo "$dir/$file/$file2" >>/tmp/checkown.log
fi
done
done
编辑回复