File tree Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Expand file tree Collapse file tree 2 files changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,7 @@ func WritePlistFile() error {
5454 RunAtLoad bool
5555 }{
5656 Program : src ,
57- RunAtLoad : false ,
57+ RunAtLoad : true , // This will start the agent right after login (and also after `launchctl load ...`)
5858 }
5959
6060 t := template .Must (template .New ("launchdConfig" ).Parse (string (launchdAgentDefinition )))
Original file line number Diff line number Diff line change @@ -335,9 +335,12 @@ func loop() {
335335 if err != nil {
336336 log .Info (err )
337337 } else {
338- err = config .LoadLaunchdAgent ()
338+ err = config .LoadLaunchdAgent () // this will load the agent: basically starting a new instance
339339 if err != nil {
340340 log .Error (err )
341+ } else {
342+ log .Info ("Quitting, another instance of the agent has been started by launchd" )
343+ os .Exit (0 )
341344 }
342345 }
343346 } else {
You can’t perform that action at this time.
0 commit comments