Change the package for all Users to one value


Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"


Top Level » DirectAdmin

Change the package for all Users to one valueLast Modified: Sep 10, 2013, 11:10 pm
If you wish to change the package from one value to another for all Users, you could use a script similar to the following:

#!/bin/sh

OLD=custom
NEW=fancy

for i in `ls /usr/local/directadmin/data/users`; do
{
       COUNT=`grep -c usertype=user /usr/local/directadmin/data/users/$i/user.conf`
       if [ "$COUNT" -eq 0 ]; then
               continue;
       fi

       echo "Updating User $i";

       perl -pi -e "s/package=$OLD/package=$NEW/" /usr/local/directadmin/data/users/$i/user.conf
};
done;
exit 0;

which will change all Users who have a custom package, to have a "fancy" package.

Then to activate the values in the user.conf, you'd simply save or edit the fancy package, and all Users with it will be updated accordingly.

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST