[K12OSN] Script help
Mike Lichtenwalner
mll at mtwp.k12.pa.us
Wed Dec 15 17:03:53 UTC 2004
David Trask wrote:
> "Support list for opensource software in schools." <k12osn at redhat.com> on
> Tuesday, December 14, 2004 at 12:01 PM +0000 wrote:
>
>>Could someone provide me with some guidance on writing a script to do
>>distriute the user.js file? The script should probably just copy the
>>file to the correct location in each user's directory and then change
>>the permissions so that the user owns it. The location for user.js is:
>>/home/UserName/.mozilla/firefox/default.XYZ/
>>(Note that the "XYZ" is a randomly generated 3 alphanumeric string for
>>each user.)
>
>
>
> Not sure if this'll work, but maybe? Copy and edit using a text
> editor...name it something like user-js-move and then chmod a+x
> user-js-move to make it executable
>
> !#/bin/bash
> for x in `ls /home`; do
> echo "Doing $x ..."
>
> /bin/cp -Rf /root/user.js
> /home/${x}/UserName/.mozilla/firefox/default.XYZ/
>
> #I'm making the assumption the the user.js file is in the root
> folder....substitute where necessary
>
> #you may be able to use a wildcard for the "default.XYX" such as default.*
>
> chown -R ${x}.Users
> /home/${x}/UserName/.mozilla/firefox/default.XYZ/user.js
>
> #(or you can simply do chown -R ${x}.Users /home/${x}/ and it will
> make sure everything in the users home dir is set right)
> #also note that I have chown -R ${x}.Users as all my users belong to the
> group Users however if you do the common RedHat way where each user is
> also a group ex: jsmith:jsmith
> #you can do chown -R ${x}.${x}
>
> David N. Trask
> Technology Teacher/Coordinator
> Vassalboro Community School
> dtrask at vcs.u52.k12.me.us
> (207)923-3100
>
Thanks, David! A couple of tweaks and it works like a charm. The final
product is:
#!/bin/bash
for x in `ls /home`; do
echo "Copying user.js to $x ..."
/bin/cp -Rf /root/user.js /home/${x}/.mozilla/firefox/default.*/
chown -R ${x}.users /home/${x}/.mozilla/firefox/default.*/user.js
done
David, any word on the summer Linux conference in Maine?
Thanks, again!
Mike
More information about the K12OSN
mailing list