-
Notifications
You must be signed in to change notification settings - Fork 0
/
notifier.sh
executable file
·70 lines (54 loc) · 1.84 KB
/
notifier.sh
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Crontab interval values
# crontab_interval_minute="*" # Every 15 minutes
# crontab_interval_hour="*" # Every hour
# crontab_interval_day_of_month="*" # Every day of the month
# crontab_interval_month="*" # Every month
# crontab_interval_day_of_week="*" # Every day
# Functions
function getHeadRevision () {
#Get parameters
local __resultvar=$1
eval $__resultvar=$(svn info $local_working_copy -rHEAD | grep Revision | cut -d' ' -f2)
}
function getWorkingCopyRevision () {
# Get parameters
local __resultvar=$1
eval $__resultvar=$(svn info $local_working_copy | grep Revision | cut -d' ' -f2)
}
# function add () {
# # Get parameters
# local __wcLocation=$1
# local __wcMessage=$2
# # Create a new crontab
# crontab -l > svn_notifier_crontab
# # Echo new cron into cron file
# echo "$crontab_interval_minute $crontab_interval_hour $crontab_interval_day_of_month $crontab_interval_month $crontab_interval_day_of_week svn-notifier-wc $local_working_copy $__wcMessage" >> svn_notifier_crontab
# # Install new cron file
# crontab svn_notifier_crontab
# # Remove temporary cron file
# rm svn_notifier_crontab
# exit
# }
function notify () {
# Get parameters
getHeadRevision __headRevision
getWorkingCopyRevision __wcRevision
if [ "$__wcRevision" -lt "$__headRevision" ]
then
terminal-notifier -message "$wcMessage" -title "Working Copy Outdated"
fi
}
# if [ "$1" = "add" ]
# then
# local_working_copy=$2
# __wcMessage=$3
# add $local_working_copy $__wcMessage
# else
# local_working_copy=$1
# wcMessage=$2
# notify
# fi
local_working_copy="/Users/Malcolm/Sites/dev.werksite.nl/public_html/malcolm/"
wcMessage="Werksite Development"
notify