Keeping Profile Manager Alive
Many people have been having problems with Profile Manager, and other services on Lion Server. I am absolutely disgusted with the QA work Apple has done here. You can't configure Lion workstations to properly work in an enterprise environment without profiles, but profile server does not work. I have a partial workaround. It isn't pretty and you will still experience a lot of intermittent failures, but the service at least recovers following a failure.
First, open a terminal and become root:
sudo -s
Now create a file:
cat > /etc/fix-profileManager.sh
And paste the following into the terminal (press CTRL-D after pasting . . .)
#!/bin/bash
if [ ! `ls -l /Library/Logs/PostgreSQL.log |grep -c '_postgres'` -gt 0 ]
then
/usr/sbin/serveradmin stop postgres
/usr/bin/touch /Library/Logs/PostgreSQL.log
/usr/sbin/chown _postgres:_postgres /Library/Logs/PostgreSQL.log
/usr/sbin/serveradmin start postgres
fi
if [ ! -L /var/log/devicemgr ]
then
/bin/ln -s /Library/Server/ProfileManager/Logs/ /var/log/devicemgr
fi
Change the permissions . . .
chmod 0755 /etc/fix-profileManager.sh
Now, export the current crontab (just in case) and add the script to the exported file . . .
crontab -l > ~/crontab-temp
cat >> ~/crontab-temp
And paste in the following . . . (press CTRL-D after pasting)
*/1 * * * * /etc/fix-profileManager.sh >/dev/null 2>&1
Now, we load the file into the crontab . . .
crontab ~/crontab-temp
That should keep things partly running.
What is going on here? Two problems that I have found so far, there are probably more. First, somehow, very frequently, the permissions on the Postgres logfile gets set incorrectly. The database server accordingly cannot run when this happens. Second, a symbolic link gets removed. I suspect that a log rotation program is causing this, but haven't dug much deeper. This script checks for the errors every minute and fixes the problems. The profile manager will still fail (a lot!!!!) but at least now it comes back without needing to reload the OS. Note also, that running fix permissions will not only not fix this problem, but will cause it. Ya, great job Apple.
Mac OS X (10.7.2), Server