Something went wrong. Try again.
Cider Isn't Darwin Emulation, Really
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261.Dd 1 May, 2009.Dt launchctl 1.Os Darwin.Sh NAME.Nm launchctl.Nd Interfaces with launchd.Sh SYNOPSIS.Nm.Op Ar subcommand Op Ar arguments ....Sh DESCRIPTION.Nm interfaces with.Nm launchdto load, unload daemons/agents and generally control.Nm launchd ..Nmsupports taking subcommands on the command line, interactively or even redirected from standard input.These commands can be stored in.Nm $HOME/.launchd.confor.Nm /etc/launchd.confto be read at the time.Nm launchdstarts..Sh SUBCOMMANDS.Bl -tag -width -indent.It Xo Ar load Op Fl wF.Op Fl S Ar sessiontype.Op Fl D Ar domain.Ar paths ....XcLoad the specified configuration files or directories of configuration files.Jobs that are not on-demand will be started as soon as possible.All specified jobs will be loaded before any of them are allowed to start.Note that per-user configuration files (LaunchAgents) must be owned by the userloading them. All system-wide daemons (LaunchDaemons) must be owned by root. Configuration filesmust not be group- or world-writable. These restrictions are in place for security reasons,as allowing writability to a launchd configuration file allows one to specify which executablewill be launched..PpNote that allowing non-root write access to the /System/Library/LaunchDaemons directory WILL render your system unbootable..Bl -tag -width -indent.It Fl wOverrides the Disabled key and sets it to false. In previous versions, this optionwould modify the configuration file. Now the state of the Disabled key is storedelsewhere on-disk..It Fl FForce the loading of the plist. Ignore the Disabled key..It Fl S Ar sessiontypeSome jobs only make sense in certain contexts. This flag instructs.Nm launchctlto look for jobs in a different location when using the -D flag, and allows.Nm launchctlto restrict which jobs are loaded into which session types. Currently knownsession types include: Aqua, LoginWindow, Background, StandardIO and System..It Fl D Ar domainLook for.Xr plist 5 files ending in *.plist in the domain given. Valid domains include"system," "local," "network" and "all." When providing a session type, an additionaldomain is available for use called "user." For example, without a session type given,"-D system" would load from property list files from /System/Library/LaunchDaemons.With a session type passed, it would load from /System/Library/LaunchAgents..El.It Xo Ar unload Op Fl w.Op Fl S Ar sessiontype.Op Fl D Ar domain.Ar paths ....XcUnload the specified configuration files or directories of configuration files.This will also stop the job if it is running..Bl -tag -width -indent.It Fl wOverrides the Disabled key and sets it to true. In previous versions, this optionwould modify the configuration file. Now the state of the Disabled key is storedelsewhere on-disk..It Fl S Ar sessiontypeSome jobs only make sense in certain contexts. This flag instructs.Nm launchctlto look for jobs in a different location when using the -D flag, and allows.Nm launchctlto restrict which jobs are loaded into which session types. Currently knownsession types include: Aqua, LoginWindow, Background, StandardIO and System..It Fl D Ar domainLook for.Xr plist 5 files ending in *.plist in the domain given. Valid domains include"system," "local," "network" and "all." When providing a session type, an additionaldomain is available for use called "user." For example, without a session type given,"-D system" would load from property list files from /System/Library/LaunchDaemons.With a session type passed, it would load from /System/Library/LaunchAgents..El.It Xo Ar submit Fl l Ar label.Op Fl p Ar executable.Op Fl o Ar path.Op Fl e Ar path.Ar -- command.Op Ar args.XcA simple way of submitting a program to run without a configuration file. This mechanism also tells launchd to keep the program alive in the event of failure..Bl -tag -width -indent.It Fl l Ar labelWhat unique label to assign this job to launchd..It Fl p Ar programWhat program to really execute, regardless of what follows the -- in the submit sub-command..It Fl o Ar pathWhere to send the stdout of the program..It Fl e Ar pathWhere to send the stderr of the program..El.It Ar remove Ar job_labelRemove the job from launchd by label..It Ar start Ar job_labelStart the specified job by label. The expected use of this subcommand is fordebugging and testing so that one can manually kick-start an on-demand server..It Ar stop Ar job_labelStop the specified job by label. If a job is on-demand, launchd may immediatelyrestart the job if launchd finds any criteria that is satisfied.Non-demand based jobs will always be restarted. Use of this subcommand is discouraged.Jobs should ideally idle timeout by themselves..It Xo Ar list .Op Ar -x .Op Ar label.XcWith no arguments, list all of the jobs loaded into.Nm launchdin three columns. The first column displays the PID of the job if it is running.The second column displays the last exit status of the job. If the number in thiscolumn is negative, it represents the negative of the signal which killed the job.Thus, "-15" would indicate that the job was terminated with SIGTERM. The third columnis the job's label..PpNote that you may see some jobs in the list whose labels are in the style "0xdeadbeef.anonymous.program".These are jobs which are not managed by.Nm launchd ,but, at one point, made a request to it..Nm launchdclaims no ownership and makes no guarantees regarding these jobs. They are stored purely forbookkeeping purposes..PpSimilarly, you may see labels of the style "0xdeadbeef.mach_init.program". These are legacy jobs that rununder mach_init emulation. This mechanism will be removed in future versions, and all remaining mach_initjobs should be converted over to.Nm launchd ..PpIf.Op Ar labelis specified, prints information about the requested job. If .Op Ar -xis specified, the information for the specified job is output as an XML property list..It Ar setenv Ar key Ar valueSet an environmental variable inside of.Nm launchd ..It Ar unsetenv Ar keyUnset an environmental variable inside of.Nm launchd ..It Ar getenv Ar keyGet an environmental variable inside of.Nm launchd ..It Ar exportExport all of the environmental variables of.Nm launchdfor use in a shell eval statement..It Ar getrusage self | childrenGet the resource utilization statistics for.Nm launchdor the children of.Nm launchd ..It Xo Ar log.Op Ar level loglevel.Op Ar only | mask loglevels....XcGet and set the.Xr syslog 3log level mask. The available log levels are: debug, info, notice, warning, error, critical, alert and emergency..It Xo Ar limit.Op Ar cpu | filesize | data | stack | core | rss | memlock | maxproc | maxfiles.Op Ar both Op Ar soft | hard.XcWith no arguments, this command prints all the resource limits of.Nm launchdas found via.Xr getrlimit 2 .When a given resource is specified, it prints the limits for that resource.With a third argument, it sets both the hard and soft limits to that value.With four arguments, the third and forth argument represent the soft and hard limits respectively.See.Xr setrlimit 2 ..It Ar shutdownTell.Nm launchdto prepare for shutdown by removing all jobs..It Ar umask Op Ar newmaskGet or optionally set the.Xr umask 2of.Nm launchd ..It Xo Ar bslist.Op Ar PID | ...Op Ar -j.XcThis prints out Mach bootstrap services and their respective states. While thenamespace appears flat, it is in fact hierarchical, thus allowing for certainservices to be only available to a subset of processes. The three states aservice can be in are active ("A"), inactive ("I") and on-demand ("D"). .PpIf.Op Ar PIDis specified, print the Mach bootstrap services available to that PID. If.Op Ar ..is specified, print the Mach bootstrap services available in the parent of thecurrent bootstrap. Note that in Mac OS X v10.6, the per-user Mach bootstrap namespaceis flat, so you will only see a different set of services in a per-user bootstrapif you are in an explicitly-created bootstrap subset..PpIf.Op Ar -jis specified, each service name will be followed by the name of the job which registeredit..It Ar bsexec Ar PID command Op Ar argsThis executes the given command in the same Mach bootstrap namespace hierachyas the given PID..It Ar bstree Op Ar -jThis prints a hierarchical view of the entire Mach bootstrap tree. If.Op Ar -jis specified, each service name will be followed by the name of the job which registered it.Requires rootprivileges..It Ar managerpidThis prints the PID of the launchd which manages the current bootstrap..It Ar manageruidThis prints the UID of the launchd which manages the current bootstrap..It Ar managernameThis prints the name of the launchd job manager which manages the current bootstrap.See LimitLoadToSessionType in.Xr launchd.plist 5for more details..It Ar helpPrint out a quick usage statement..El.Sh ENVIRONMENTAL VARIABLES.Bl -tag -width -indent.It Pa LAUNCHD_SOCKETThis variable informs launchctl how to find the correct launchd to talk to. If it is missing, launchctl will use a built-in default..El.Sh FILES.Bl -tag -width "/System/Library/LaunchDaemons" -compact.It Pa ~/Library/LaunchAgentsPer-user agents provided by the user..It Pa /Library/LaunchAgentsPer-user agents provided by the administrator..It Pa /Library/LaunchDaemonsSystem wide daemons provided by the administrator..It Pa /System/Library/LaunchAgentsMac OS X Per-user agents..It Pa /System/Library/LaunchDaemonsMac OS X System wide daemons..El.Sh SEE ALSO .Xr launchd.plist 5 ,.Xr launchd.conf 5 ,.Xr launchd 8