Scripts and multiple users

I asked about this over at Apple’s forums, but no responses…

Any help on this would be greatly appreciated.

I am deploying a collection of scripts to multiple computers and then have users access them via the Script Menu. What I’ve been doing is copying a folder containing all of my scripts to the root level of each machine’s hard drive. I then have a “setup” script that creates the necessary structure in the ~/Library/Scripts folder and fills it with aliases to the scripts in the folder on root. This works fine, but it requires each user to run the script manually in order to “setup”. Each machine has a minimum of 2 users available for use (and therefore needs to be “setup” individually)

I would like to figure out a way to automatically update/“setup” each user when I modify of update the scripts. Usually only one or two scripts change, but we push the entire folder out to the client computers, replacing what is already there, using Apple Remote Desktop. After that each user on each client needs to run the setup script to have access to the updated scripts (recreate or update aliases in ~/Library/Scripts). I know of no way to setup each users’ ~/Library/Scripts folder. Perhaps there is a way to do it using a command line script as “sudo”? These machines do not have ‘root’ enabled, nor is it possible to enable ‘root’ to solve this problem.

Anyone have any ideas how to automate the setup of each user? I have contemplated using /Library/Scripts/ for installation of these scripts (via a package installed under Apple Remote Desktop) but I would like to retain the features of using the user’s Library/Scripts folder, particularly the ability to segregate scripts by application. The other optin I can think of is invoking a shell sript with cron every so often (hour, minute…?) to launch my “setup” script. I have not idea how to setup a shell script to go into users’ folders.

Thanks in advance for any suggestions.

Teorically, the user folder should be read-writable (no need sudo)… Anyway, after the first time you create the aliases structure in the scripts folder, the scripts should be automatically updated when you overwrite the original files in their root folder if they don’t change the name, but only the contents. Is this true for you?

jj, thanks for your reply.

i have tried making aliases and moving/copying files to another user’s Scripts folder for example via:


set copiedFile to duplicate thisFile to folder "Macintosh HD:Users:anotherUser:Library:Scripts:"

while logged in as a different user to no avail; permission denied. Also I cannot “cd” to another user’s Scripts folder in Terminal, again permission denied. So no read/write access.

Unfortunately, the name of each updated script does change (I have to use a …“v1.x” suffix to indicate version).

Thanks though, any other thoughts?

Hi,

What if you use a folder instead. Say the name of the folder is “User Scripts”. You place this folder at the root level of the hard disk. Then what jj was saying is you make alias of the “User Scripts” folder to the different users Scripts folder. Then you just need to keep the name of that folder the same “User Scripts” and the names of the scripts may change. You just need to run the install script once for each user.

gl,

… Or include the version in the own script:

property vers: "1.52"

This would be the easy way. You could also use a “do shell script with administrator privileges” and copy the stuff using “ditto”.

Thanks for the suggestions!

jj, Once a solution is decided upon, versioning inside each script may be a possibility. Currently versioning in the name provided quick visual feedback of the latest version for users, IT, and myself. The setup would still have to be run if new script were added. Thanks for the suggestion of “ditto”. I will look into this.

kel, if I just used a folder to place these into the users’ /Library/Scripts I’m not sure if I could still use the feature of the user scripts folder that allows me to segregate the menu by application (using the so-called Application Scripts folder - see http://www.apple.com/applescript/scriptmenu/01.html). I assumed that I would not, but I need to test this. Thanks!

Using a loop such as for, you could run thought a list of all the users, on the system, using sudo

this would be simple if all of the users are in one directory such as /Users something like what is below should work (this is untested however)

#! /bin/bash
cd /Users/

for u in * ; do

sudo ditto /MyScripts /Users/$u/Library/Scripts

done
exit 0

hope this helps. :rolleyes: