Using the PaperCut Mac Client Login Hook With Other Login Scripts

The Mac login hook functionality is used to start the PaperCut client tool automatically when users log in. If you are already using a login script, or want to install additional scripts, the setup procedure will be slightly different to the standard way (double clicking on install-login-hook.command).

The login hook on Mac can point to one script only. To run multiple scripts on login, the master login hook script should call your multiple other login scripts.

If scripting isn't your thing, you could try a more GUI oriented way using software such as LoginWindow Manager.

Note: The following article assumes some basic scripting experience.


A) If you already have a login hook

If you already have a login hook set up, simply insert the following line at the end of your existing login hook script:

/Applications/PCClient.app/Contents/Resources/login-hook-start "$1"

This will call the PaperCut script at the end of your current login procedures.


B) To call multiple login scripts

If you've already set up the PaperCut Mac client with the login hook and you want to add other scripts run run at login, perform the following:

1. Create a new text file to function as the master login hook script. The contents should be similar to the following:
#!/bin/sh

# call login script #1 here

# call login script #2 here

# call the PaperCut user client login script
/Applications/PCClient.app/Contents/Resources/login-hook-start "$1"
2. Set execute permissions on the master login hook script:
sudo chmod a+x "/Path/To/Script"
3. Set the login hook property to point it to your master login hook script:
sudo defaults write com.apple.loginwindow LoginHook "/Path/To/Script"


Configuring the login hook

The login hook can be enabled by typing the following at a terminal:

sudo defaults write com.apple.loginwindow LoginHook "/Path/To/Script"

And removed / disabled by typing the following:

sudo defaults delete com.apple.loginwindow LoginHook

Note: in the master login hook script, "$1" is the username variable (i.e. the user who is logging in)


Categories: User Client Tool, Apple Mac, Scripting

Page last modified on September 15, 2008, at 08:04 PM