Skip to content

This library is useful if you wish to make a service which is automatically started by launchd.

License

Notifications You must be signed in to change notification settings

murmour/ocaml-launchd

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OCaml bindings to the launchd API

This library is useful if you wish to make a service which is automatically started by launchd.

Please read the Unix API documentation (and the Lwt_unix version).

Example

First build the code

make

Assuming you are running under OS X, install the example services as LaunchAgents for the current user:

$ ./install-example.sh

Check the agents have registered:

$ launchctl list | grep org.recoil
34787	0	org.recoil.dave.anotherd
-	0	org.recoil.dave.exampled

One of them is listening on port 8081:

$ telnet localhost 8081
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
Hello there!
Connection closed by foreign host.

And the other is listening on a Unix domain socket:

$ ls -l /var/run/org.recoil*
srw-rw-rw-  1 djs  staff  0  9 Oct 14:06 /var/run/org.recoil.dave.exampled

Run this script to remove the agents:

$ ./uninstall-example.sh

About

This library is useful if you wish to make a service which is automatically started by launchd.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • OCaml 67.7%
  • C 28.5%
  • Shell 3.8%