Using the PaperCut Mac Client Login Hook With Other Login Scripts

KB Home   |   Using the PaperCut Mac Client Login Hook With Other Login Scripts

Main.MacLoginHook History

Hide minor edits - Show changes to output

October 17, 2014, at 01:35 AM by TimG - Updated to include information about preferred Launchd method
Added lines 3-4:
'''Note: The preferred method of starting the PaperCut Client automatically for all users is to use the [[https://www.papercut.com/kb/Main/MacClientStartupWithLaunchd|Launchd method]] using Launch Agents as advised by [[https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CustomLogin.html|Apple]]'''
Deleted lines 8-12:

'''Note:''' The following article assumes some scripting experience.

\\

Deleted lines 16-17:
\\
Deleted lines 43-44:
\\
Changed line 57 from:
''Categories:'' [[Category.UserClientTool|+]], [[Category.Mac|+]], [[Category.Scripting|+]]
to:
''Categories:'' [[Category.UserClientTool|+]], [[Category.Mac|+]], [[Category.Scripting|+]]
Changed lines 8-9 from:
'''Note:''' The following article assumes some basic scripting experience.
to:
'''Note:''' The following article assumes some scripting experience.
Changed lines 12-15 from:
!!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:
to:
!!A) If you already have a login hook script in place

If you already have a login hook script
set up, simply insert the following line at the end of your existing login hook script:
Changed lines 24-27 from:
If you've already set up the PaperCut Mac client with the login hook and you want to add other scripts to 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:
to:
If you've already set up the PaperCut Mac client with the login hook (say another application is using the method), perform the following:

->1. Create a new text file to function as the master/wrapper login hook script.  The contents should be similar to the following example:
Changed lines 31-34 from:
# call login script #1 here

# call login script #2 here
to:
# call login script/program #1 here
[path to my other login script]

# call login script/program #2
here
[path to another program starting via a login script]
May 21, 2012, at 07:06 PM by 67.170.157.102 - duplicate word
Changed lines 24-25 from:
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:
to:
If you've already set up the PaperCut Mac client with the login hook and you want to add other scripts to run at login, perform the following:
Changed line 62 from:
''Categories:'' [[Category.UserClientTool|+]], [[Category.AppleMac|+]], [[Category.Scripting|+]]
to:
''Categories:'' [[Category.UserClientTool|+]], [[Category.Mac|+]], [[Category.Scripting|+]]
August 18, 2009, at 07:30 PM by rick - removed link to bombich discontinued software
Changed lines 7-8 from:
If scripting isn't your thing, you could try a more GUI oriented way using software such as [[http://www.bombich.com/software/lwm.html | LoginWindow Manager]].
to:
Added line 10:
Changed line 62 from:
''Categories:'' [[Category.UserClientTool|+]], [[Category.AppleMac|+]]
to:
''Categories:'' [[Category.UserClientTool|+]], [[Category.AppleMac|+]], [[Category.Scripting|+]]
Added line 9:
'''Note:''' The following article assumes some basic scripting experience.
Added lines 7-8:
If scripting isn't your thing, you could try a more GUI oriented way using software such as [[http://www.bombich.com/software/lwm.html | LoginWindow Manager]].
Changed lines 11-12 from:
If you already have a login hook set up, simply insert the following line at the end of your existing master login hook script:
to:
If you already have a login hook set up, simply insert the following line at the end of your existing login hook script:
Added lines 15-16:
This will call the PaperCut script at the end of your current login procedures.
Changed lines 40-41 from:
->3. Enable the login hook and point it to your master login hook script:
to:
->3. Set the login hook property to point it to your master login hook script:
Added lines 1-57:
(:title 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.

\\

!!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 master login hook script:

->[@/Applications/PCClient.app/Contents/Resources/login-hook-start "$1"@]

\\

!!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. Enable the login hook and 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:'' [[Category.UserClientTool|+]], [[Category.AppleMac|+]]

Comments

Share your findings and experience with other PaperCut users. Feel free to add comments and suggestions about this Knowledge Base article. Please don't use this for support requests.

Article last modified on October 17, 2014, at 01:35 AM
Printable View   |   Article History   |   Edit Article