重建directadmin user.list用户

[不指定 2012/11/30 09:32 | by Totti ]
| |
If your users.list files for all of your Resellers/Admins becomes corrupt, you can create and run this script to rebuild them all.
Corruption can happen during any process that writes the users.list file if multiple processes are saving the file at the same time (locking issue).  Things like backup restores in the background could in theory cause it, while browsing in DA.
It assumes that usertype=user, and creator=hiscreator exists in all user.conf files.

Create a fix.sh somewhere and fill it with the following code:
#!/bin/sh

cd /usr/local/directadmin/data/users

for r in `ls */reseller.conf | cut -d/ -f1`; do
{
     echo "fixing Reseller $r ...";

     echo -n '' > $r/users.list

     for u in `grep "^creator=$r$" */user.conf | cut -d/ -f1`; do
     {
         ISUSER=`grep -c usertype=user $u/user.conf`
         if [ "$ISUSER" = "1" ]; then
             echo $u >> $r/users.list
         fi
     };
     done;
};
done;


chmod the fix.sh to 755 and run it.
It can be run repeatedly as the users.list files are emptied before the run starts.
收集 | 评论(0) | 引用(0) | 阅读(28435)
发表评论
昵称

网址

电邮
打开HTML 打开UBB 表情 打开表情 隐藏 记住我 [注册]