-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathSAV_Eject_USB.sh
More file actions
42 lines (31 loc) · 2.18 KB
/
SAV_Eject_USB.sh
File metadata and controls
42 lines (31 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
######################################## HISTORY ###########################################################
# #
# By Tim Kimpton #
# #
# 21/2/2013 #
# #
# Version 1.0 #
# #
# To be used in conjunction with a launch daemon with watch paths to /Library/Logs/Sophos\ Anti-Virus.log #
# #
# If a SAV Threat is detected in the SAV log then the external device is ejected #
# #
############################################################################################################
######################################## VARIABLES #########################################################
# Get the Volume name from the SAV log
diskName=`grep "Threat" /Library/Logs/Sophos\ Anti-Virus.log | grep "Volumes" | cut -d"/" -f3`
# Get the disk identifier
identifier=`diskutil list | grep "${diskName}" | awk '{print $7}'`
date=`date "+%d-%m-%y_%H.%M"`
################################# DO NOT MODIFY BELOW THIS LINE #############################################
# Check to see if Threat exists
if grep "Threat" /Library/Logs/Sophos\ Anti-Virus.log ;then
# Eject the volume
hdiutil eject -force "${identifier}"
# Rename the log
mv /Library/Logs/Sophos\ Anti-Virus.log /Library/Logs/"${date}"_Sophos\ Anti-Virus.log
# Update SAV to receate the log
/usr/bin/sophosupdate
fi
exit 0