Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A script to restart NetInfo parent databases UNIX
After making changes to NetInfo parent databases accessed by client computers, it is customary to restart your server. A more elegant way is to just restart the netinfod processes. This is done by sending a Hang Up signal to the nibindd process, which also restarts any and all netinfod processes running. Note that you must have a parent NetInfo database running to have a nibindd process, so this hint usually doesn't apply to Mac OS X non-server computers.

If you use the following script in a .command file so you can run it by double-clicking the document in the Finder, don't use the string 'nibind' anywhere in the file name as it will generate some error messages. I leave the reason as an exercise for the students.
#!/bin/sh
#
# A shell script to restart nibindd
#

# Get the PID of nibindd
pid=`ps -ax | grep nibind | grep -v grep | awk '{print $1}'`
echo "Current PID of nibindd is" $pid

# Authenticate and restart the process
echo "Please authenticate to restart nibindd..."
sudo kill -HUP $pid

# Wait for the old process to die
sleep 1

# Display the new PID to confirm that it worked
pid=`ps -ax | grep nibind | grep -v grep | awk '{print $1}'`
echo "New PID of nibindd is" $pid
Remember to make the script executable and place it somewhere on your path.
    •    
  • Currently 0.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (0 votes cast)
 
[2,756 views]  

A script to restart NetInfo parent databases | 1 comments | Create New Account
Click here to return to the 'A script to restart NetInfo parent databases' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use SystemStarter instead
Authored by: MasterUltan on Oct 01, '02 10:32:36AM

Apple provides scripts and a program to run these scripts called "SystemStarter". The scripts it runs are in /System/Library/StartupItems. To restart netinfod you issue the command: SystemStarter restart NetInfo
Do a "man SystemStarter" for more details.



[ Reply to This | # ]