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

Run Perforce P4D server as a daemon UNIX
Here's how I set up Perforce's P4D server as a daemon on OSX (10.3.6). Finding this info on Google is, well, impossibl -- so I thought it handy to have some reference to it here, so that people would be able to find it more easily. The Perforce site seems lacking in documentation as far as I can tell. First, as root, create a file in /etc/xinetd.d called perforce, with the following contents:
service perforce
{
    disable = no
    flags       = REUSE
    socket_type = stream
    wait        = no
    user        = root
    server      = /usr/local/bin/p4d
    server_args = -i -L /var/log/p4d.log -r /usr/local/p4root
}


The contents of my xinet.d directory looks like:
G5:~ mdavis$ cd /etc/xinetd.d/
G5:/etc/xinetd.d mdavis$ ls
auth            daytime-udp     ftp             shell           tftp
bootps          echo            login           smb-direct      time
chargen         echo-udp        nmbd            smbd            time-udp
chargen-udp     eppc            ntalk           ssh
comsat          exec            perforce        swat
daytime         finger          printer         telnet
You can change the path to the P4D binary and, of course, the log file and the Perforce root. I couldn't get any other user other than root to work, even when I created a "p4" user in NetInfo along with a group all based on the copying the settings from mysql. Dunno why, probably because I'm not a UNIX guru. You also need to edit /etc/services as follows:
#netview-aix-6   1666/udp   # netview-aix-6
perforce        1666/tcp   # Perforce Server
#netview-aix-6   1666/tcp   # netview-aix-6
Of course, I'm using the default port, but you could use any port you like providing p43 knows about it (via server_args). You'll get a log file which you can see with tail -f command, or in Console.app at /var -> log -> p4d -> log. When you're done, either reboot or restart xinetd like this:
G5:/etc/xinetd.d mdavis$ ps -ax | grep xinetd
  402  ??  Ss     0:00.15 xinetd -inetd_compat -pidfile /var/run/xinetd.pid

G5:/etc/xinetd.d mdavis$ sudo kill -HUP 402
Enjoy!
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[9,970 views]  

Run Perforce P4D server as a daemon | 5 comments | Create New Account
Click here to return to the 'Run Perforce P4D server as a daemon' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Run Perforce P4D server as a daemon
Authored by: castiron on Nov 15, '04 09:47:10PM

I have not tried but the OS X recommended way to run a server daemon is to creat a startup script under /Library/StartupItems. That should take care of your permition issues and allow you to monitor your server through the OS tools and auto restart it if it dies. It also allows for startup dependencies and clean shutdowns as well as trigering backups of your pfdb.



[ Reply to This | # ]
Run Perforce P4D server as a daemon
Authored by: only_mortal on Nov 17, '04 12:22:55PM

Startup items is deprecated, according to the Apple docs. Also, it appears, you need to have support for startup and shutdown functions though these could be done via a shell script.



[ Reply to This | # ]
Run Perforce P4D server as a daemon
Authored by: TonyCorman on Nov 19, '04 11:51:35AM

Perforce Tech Pubs mgr here -- if our doc lacks information that you need to run p4d on OS X, please please please email manuals@perforce.com and tell us what you need!



[ Reply to This | # ]
Run Perforce P4D server as a daemon
Authored by: only_mortal on Nov 19, '04 06:20:14PM

An installer would be very handy.



[ Reply to This | # ]
Run Perforce P4D server as MANY daemons..
Authored by: mysty on Feb 16, '05 05:08:52PM
This is great! Thanks for the tip here. After a fair bit of mucking around in 10.3.8, I finally managed to get past the "No such user(s)" dialogue. It may have been after I installed the CLI tool and did

> /usr/local/bin/p4 -H localhost -p 1666 user 
Having thus verified that the client was connecting on port 1666 and that there was the right user - from the TextEdit window that popped up, the GUI client then seemed to work properly. Not sure if I'm now spawning LOADS of p4d processes... Keep seeing this in the console

Feb 16 22:01:45 localhost xinetd[398]: START: perforce pid=1601 from=127.0.0.1
Feb 16 22:02:03 localhost xinetd[398]: START: perforce pid=1602 from=127.0.0.1
Feb 16 22:02:13 localhost xinetd[398]: START: perforce pid=1603 from=127.0.0.1
Feb 16 22:02:27 localhost xinetd[398]: START: perforce pid=1604 from=127.0.0.1
Feb 16 22:02:39 localhost xinetd[398]: START: perforce pid=1605 from=127.0.0.1
Thanks ever
--

[ Reply to This | # ]