uber
November 28, 2017, 10:17am
1
Hi
I’m trying to apply the below sh script to a Mac in as a new fixlet but it fails.
This works direct on ths client itself when run in Terminal.
Is there a path location on Mac OS which explains why it fails?
What else do I need to add to the script to make it work?
thanks
#!/bin/bash
rm -r ~/Library/Safari/History.db
rm -r ~/Library/Safari/Databases
rm -r ~/Library/Safari/LocalStorage
rm -r ~/Library/Safari/Touch\ Icons\ Cache
rm -r ~/Library/Caches/com.apple.Safari/Cache.db
rm -r ~/Library/Caches/com.apple.Safari/Cache.db-shm
rm -r ~/Library/Caches/com.apple.Safari/Cache.db-wal
rm -r ~/Library/Caches/com.apple.Safari/fsCachedData
rm -r ~/Library/Caches/Metadata/Safari/History
rm -r ~/Library/Cookies/com.apple.safari.cookies
rm -r ~/Library/Cookies/com.apple.Safari.SafeBrowsing.binarycookies
rm -r ~/Library/Cookies/com.apple.Safari.SearchHelper.binarycookies
rm -r ~/Library/WebKit/com.apple.Safari
Did you try QnA? Also, when I run scripts like PowerShell it requires to invoke
action uses wow64 redirection {not x64 of operating system}
I know this is for SH and its for Mas OS X not PC. but perhaps it can provide some guidance.
There is also the DOS in action scripting.
Perhaps try something like this, tho this is for Linux
delete createfile
delete /root/Desktop/runqna.sh
createfile until ZZZZZZ
#!/bin/sh BESClientConfigPath=/var/opt/BESClient/besclient.config export BESClientConfigPath
LD_LIBRARY_PATH=/opt/BESClient/binn
/opt/BESClient/bin/qna ZZZZZZ
move createfile /root/Desktop/runqna.sh
wait /bin/sh -c "chmod 0755 /root/Desktop/runqna.sh"
uber
November 28, 2017, 1:52pm
3
I’m not aware of QnA.
As I say the script works in terminal in Mac OS and I created a fixlet in Bigfix and added the .sh script but its not working. Anyone else have the answer?
It fails, does anyone know the location in Mac OS of a log file giving an explansation of why its failed?
alinder
November 28, 2017, 2:32pm
4
This isn’t working for you because ~/Library refers to the library of the user running the script, which is root for BigFix actions. You’ll have to either specify the full path or use action script to createfile the script and use relevance to substitute in the current logged on user.
1 Like
uber
November 28, 2017, 3:21pm
5
This needs to work for hundreds of Mac machines so specifiying the full path for each user I guess isnt an option?
If I go the actionscript way what needs to be input?
Here is a snip of shell script that you can use to run through the Library folders of all users:
for each in /Users/*
do
rm -r "$each/Library/Safari/History.db"
rm -r "$each/Library/Safari/Databases"
rm -r "$each/Library/Safari/LocalStorage"
done
Keep adding all the paths you need removed.
if you need to remove these for the current user, you can build the script using createfile:
delete __createfile
delete /tmp/myscript.sh
createfile until EOF
#!/bin/sh
rm -r "/Users/{name of current user}/Library/Safari/History.db"
rm -r "/Users/{name of current user}/Library/Safari/Databases"
EOF
move __createfile /tmp/myscript.sh
wait /bin/sh /tmp/myscript.sh