Skip to main content
Question

Kill All appname script completes but exit code 1


atomczynski11
Forum|alt.badge.img+18

I'm working on a script which will update the (Google) Backup and Sync App to the current version.

I have few scripts as part of the policy:
"Quit Backup and Sync" - priority Before
"Install Google Backup and Sync" - priority After
"Open Backup and Sync" - priority After

The quit app script is as follows:
#!/bin/bash
killall Backup and Sync

When I look at the policy log I see the following:
Script exit code: 1
Script result: No matching processes were found<br/>
Error running script: return code was 1.

I suspect the app quits as part of the install script.

7 replies

mickgrant
Forum|alt.badge.img+12
  • Contributor
  • 140 replies
  • October 21, 2019

give this command a try, I have tested it and i will definitely shutdown backup and sync

#!/bin/sh
for pid in `ps -ef | grep 'Backup and Sync.app' | awk '{print $2}'` ; do kill $pid ; done

Forum|alt.badge.img+31
  • Honored Contributor
  • 2721 replies
  • October 21, 2019

Does it have helpers or user agents? If so, you might want to look at quitting it a different way since PID can be unreliable or have weird results.


mickgrant
Forum|alt.badge.img+12
  • Contributor
  • 140 replies
  • October 22, 2019

@tlarkin the script above pulls the PID of anything related to backup and sync and kills them all


atomczynski11
Forum|alt.badge.img+18
  • Author
  • Jamf Heroes
  • 291 replies
  • October 22, 2019

@mickgrant I've used your script, when I run it as part of the workflow I see
Script exit code: 1
No such process<br/>
Error running script: return code was 1.


mickgrant
Forum|alt.badge.img+12
  • Contributor
  • 140 replies
  • October 22, 2019

@atomczynski its probably because jamf is running the command as root, and not seeing the process running as the user.


Forum|alt.badge.img+31
  • Honored Contributor
  • 2721 replies
  • October 22, 2019

@mickgrant I see it iterates through a data set of PIDs, the problem with that is, what happens when you kill the wrong thing. If an app has helpers that register as another process, you could potentially also kill them


atomczynski11
Forum|alt.badge.img+18
  • Author
  • Jamf Heroes
  • 291 replies
  • October 23, 2019

I was able to quit the app by doing this:

#!/bin/bash
osascript -e 'tell application "Backup and Sync" to quit'

So far I've tested it on one machine only.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings