wsdhnet
04-28-2007, 03:16 PM
I need a script written that will read the list of users on a CPanel box, loop through the list and copy a file to a folder in each users account.
The folder location and the filename will change for each job.
Bonus points if you can set it up so that it will copy an entire folder to each account.
John
BMurtagh
04-28-2007, 04:18 PM
Hey there, I'm interested in talking to you about your project. Can you PM me your AIM/email to reach you?
ajsbsd
05-03-2007, 10:57 AM
I can do this in 10 minutes. PM if interested.
theBleeber
05-22-2007, 06:54 AM
#!/bin/bash
cpUSERS=`ls /var/cpanel/users`
foldername="$1"
location="$2"
if [[ $foldername == "" || $location == "" ]]
then
echo "Usage:"
echo " $0 <folder name> <location>"
exit 1;
fi
for user in $cpUSERS
do
cp $foldername $location
echo "$foldername copied to $location for user: $user"
done
Drop this into a file and chmod the file 700.
hum. what about just typing this in shell?
for dest in `ls -d /home/*/www`; do cp /root/myfile.txt $dest; done
As well, I suspect that a simlink may help you better. This way if you change that webpage... you will update automatically all users.
:-)
oh, I forgot
chmod 700 /home/*/www/myfile.txt
;)