Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8611939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T04:30:09+00:00 2026-06-12T04:30:09+00:00

EDIT: It appears as if I am getting an error in the console com.apple.launchd:

  • 0

EDIT: It appears as if I am getting an error in the console
com.apple.launchd: (com.xxxx.adbind[57]) Exited with code: 1

What does that even mean?

Also; if I load the launchd plist file logged in by using the launchctl command it works fine!

I’m driving myself crazy trying to figure out why my launchd is not working. I’m using this in Mountain Lion 10.8.2 When I manually start it using launchctl it says it’s loaded, but the script is not running. The script when ran manually works fine as well. Perhaps it just needs a better set of eye’s to look at what I’m doing.

First, I’ll explain what it is I’m trying to accomplish. I’m having about 400 computers imaged off site. I need these computers bound to AD, which can’t be done out of our network. I figured by having a launchd script run at startup to call a script, then have the script check to see if it’s in the network before it runs I can have these computers bound at first startup in our network before an AD user logs in.

Here’s my launchd, I’m putting it in /Library/launchDaemons

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.xxxx.adbind</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/bin/adbind.bash</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>WorkingDirectory</key>
    <string>/usr/local/bin</string>
</dict>
</plist>

I’ve tried using this with and without a WorkingDirectory key.

Here’s my script, I’m putting my script in /usr/local/bin

#!/bin/bash

computerid=`/usr/sbin/scutil --get LocalHostName`

# Standard parameters
domain="xxx.xxxx.edu"           # fully qualified DNS name of Active Directory Domain
udn="xxxxxx"            # username of a privileged network user
password="xxxxx"                    # password of a privileged network user
ou="OU=xxx,DC=xxx,DC=xxxx,DC=edu"       # Distinguished name of container for the computer

# Advanced options
alldomains="enable"         # 'enable' or 'disable' automatic multi-domain authentication
localhome="enable"          # 'enable' or 'disable' force home directory to local drive
protocol="smb"              # 'afp' or 'smb' change how home is mounted from server
mobile="enable"         # 'enable' or 'disable' mobile account support for offline logon
mobileconfirm="disable"     # 'enable' or 'disable' warn the user that a mobile acct will be created
useuncpath="enable"         # 'enable' or 'disable' use AD SMBHome attribute to determine the home dir
user_shell="/bin/bash"      # e.g., /bin/bash or "none"
preferred="-preferred xxx.xxxxx.edu"    # Use the specified server for all Directory lookups and authentication
                            # (e.g. "-nopreferred" or "-preferred ad.server.edu")
admingroups="xxx\admins,xxx\teachers,xxx\ADManagement - Computers,xxx\employees"    # These comma-separated AD groups may administer the machine (e.g. "" or "APPLE\mac admins")

# Login hook setting -- specify the path to a login hook that you want to run instead of this script

### End of configuration

## Wait until all network services are up.
ipconfig waitall

# Check to see if we're in the district
if ping -c 1 xxx.xxx.x.x
then

# Activate the AD plugin
defaults write /Library/Preferences/DirectoryService/DirectoryService "Active Directory" "Active"
plutil -convert xml1 /Library/Preferences/DirectoryService/DirectoryService.plist
sleep 5

# Remove computer from OU
dsconfigad -f -r -u xxxxxxx -p xxxxxx
sleep 5

# Bind to AD
dsconfigad -f -a $computerid -domain $domain -u $udn -p "$password" -ou "$ou"

# Configure advanced AD plugin options
if [ "$admingroups" = "" ]; then
    dsconfigad -nogroups
else
    dsconfigad -groups "$admingroups"
fi

dsconfigad -alldomains $alldomains -localhome $localhome -protocol $protocol \
    -mobile $mobile -mobileconfirm $mobileconfirm -useuncpath $useuncpath \
    -shell $user_shell $preferred

# Restart DirectoryService (necessary to reload AD plugin activation settings)
killall DirectoryService

# Add the AD node to the search path
if [ "$alldomains" = "enable" ]; then
    csp="/Active Directory/All Domains"
else
    csp="/Active Directory/$domain"
fi


# This works in a pinch if the above code does not
defaults write /Library/Preferences/DirectoryService/SearchNodeConfig "Search Node Custom Path Array" -array "/Active Directory/All Domains"
defaults write /Library/Preferences/DirectoryService/SearchNodeConfig "Search Policy" -int 4
defaults write /Library/Preferences/DirectoryService/ContactsNodeConfig "Search Node Custom Path Array" -array "/Active Directory/All Domains"
defaults write /Library/Preferences/DirectoryService/ContactsNodeConfig "Search Policy" -int 4

plutil -convert xml1 /Library/Preferences/DirectoryService/SearchNodeConfig.plist

## Remove the script and launchd job. Be sure to delete the script.
launchctl unload -w /Library/LaunchDaemons/com.xxxx.adbind.plist 
rm /Library/LaunchDaemons/com.xxxx.adbind.plist
rm /usr/local/bin/adbind.bash

exit 0
else
echo "District not Available. Quitting"
exit 1
fi

Thanks for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T04:30:11+00:00Added an answer on June 12, 2026 at 4:30 am

    Well, I finally worked through my problem and have found a solution! I’m going to post the answer here in order to hopefully help someone else someday! It seems as if the launchd file wasn’t running long enough to run my entire script. So I added the KeepAlive key to the plist. It looks like this now.

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.xxxx.adbind</string>
        <key>KeepAlive</key>
        <dict>
            <key>SuccessfulExit</key>
            <false/>
        </dict>
        <key>ProgramArguments</key>
        <array>
            <string>/usr/local/bin/adbind.bash</string>
        </array>
        <key>RunAtLoad</key>
        <true/>
    </dict>
    </plist>
    

    I also had troubles with permissions and found that the “bin” folder I created and placed the script into wasn’t owned by root. So I ran chown and chmod on my files and folders. Like this.

    sudo chown root:wheel bin
    sudo chown root:wheel adbind.bash
    sudo chmod 755 adbind.bash
    sudo chown root:wheel com.xxxx.adbind.plist
    sudo chmod 755 com.xxxx.adbind.plist
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting this error some time, without any action I do This appears at
I am trying to done that tutorial http://blog.springsource.com/2011/01/04/green-beans-getting-started-with-spring-mvc/ but I am stuck just before
Possible Duplicate: Plugging in to Java compilers Edit - this appears to be a
I am trying to remove/edit the text shown in the picture which appears from
EDIT: I was an idiot. I simply had an image that was vertically long,
EDIT: See my answer below--> I am wanting to have a view that when
EDIT: iam using ajax to load text in my content that is why onload
Edit : Note that, as Daniel and latkin noted in an answer and a
EDIT : It turned out that this can only be done through an external
Why am I getting an error in my json use in ie6 and ie7,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.