Posted on 10-21-2019 02:10 PM
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.
Posted on 10-21-2019 03:24 PM
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
Posted on 10-21-2019 03:33 PM
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.
Posted on 10-21-2019 06:01 PM
@tlarkin the script above pulls the PID of anything related to backup and sync and kills them all
Posted on 10-22-2019 08:06 AM
@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.
Posted on 10-22-2019 03:50 PM
@atomczynski its probably because jamf is running the command as root, and not seeing the process running as the user.
Posted on 10-22-2019 04:07 PM
@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
Posted on 10-23-2019 03:12 PM
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.