There are some recent apps, e.g., Cisco Secure Client / AnyConnect VPN service, where the service cannot be stopped/started using the LaunchControl.app.
For more control over what's running on the machine and when, I would like to be able to stop/start the service using the command line and make sure that it is loaded properly by checking its state using appropriate commands.
However, the method I have to stop the service results in me not being able to query the service status after I start the service back up.
What is the proper way to stop/start services for "bundled services" ??
To start, I check whether the service is running on or not:
$ launchctl print system/com.cisco.secureclient.vpn.service.agent system/com.cisco.secureclient.vpn.service.agent = { active count = 1 path = (submitted by smd.303) type = Submitted managed_by = com.apple.xpc.ServiceManagement state = running program identifier = Contents/MacOS/vpnagentd (mode: 2) parent bundle identifier = com.cisco.secureclient.vpn.service BTM uuid = 61DCA467-D6AD-4251-90D7-E49891CEAE80 arguments = { vpnagentd -execv_instance } default environment = { PATH => /usr/bin:/bin:/usr/sbin:/sbin } environment = { XPC_SERVICE_NAME => com.cisco.secureclient.vpn.service.agent } domain = system minimum runtime = 10 exit timeout = 45 runs = 2 pid = 1987 immediate reason = inefficient forks = 5 execs = 1 initialized = 1 trampolined = 1 started suspended = 0 proxy started suspended = 0 last exit code = 0 spawn type = daemon (3) jetsam priority = 40 jetsam memory limit (active) = (unlimited) jetsam memory limit (inactive) = (unlimited) jetsamproperties category = daemon submitted job. ignore execute allowed jetsam thread limit = 32 cpumon = default job state = running probabilistic guard malloc policy = { activation rate = 1/1000 sample rate = 1/0 } properties = partial import | keepalive | abandon process group | resolve program | has LWCR I can stop this service using the following command:
sudo launchctl bootout system/com.cisco.secureclient.vpn.service.agent However, when I do that, I cannot re-load the service back again to a state that is recognizable by LaunchControl, nor is it listed in launchctl print system/com.cisco.secureclient.vpn.service.agent
$ launchctl print system/com.cisco.secureclient.vpn.service.agent Bad request. Could not find service "com.cisco.secureclient.vpn.service.agent" in domain for system 

