rsync_wrap 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rsync_wrap.rb +16 -2
- metadata +1 -1
data/lib/rsync_wrap.rb
CHANGED
@@ -66,6 +66,12 @@ class RsyncWrap
|
|
66
66
|
@rsyncCommand.push('--delete')
|
67
67
|
end
|
68
68
|
|
69
|
+
# Logging. Mostly usefull for debugging
|
70
|
+
@logging = params["logging"] unless params["logging"].nil?
|
71
|
+
if @backup == 'true'
|
72
|
+
@logging = true
|
73
|
+
end
|
74
|
+
|
69
75
|
# SSH varibles
|
70
76
|
@transport = params["transport"] unless params["transport"].nil?
|
71
77
|
@server = params["server"] unless params["server"].nil?
|
@@ -112,6 +118,14 @@ class RsyncWrap
|
|
112
118
|
|
113
119
|
# Run the rsync command
|
114
120
|
rCommand = @rsyncCommand.join(' ')
|
115
|
-
|
116
|
-
|
121
|
+
# Decide to log or not.
|
122
|
+
if @logging == true
|
123
|
+
puts "DEBUG : Logging enabled"
|
124
|
+
`echo \`date +%d-%m-%Y | %H:%M:%S\` #{localDir} >> /tmp/rsyncwrap.log`
|
125
|
+
system rCommand
|
126
|
+
else
|
127
|
+
puts "no logging for me"
|
128
|
+
system rCommand
|
129
|
+
end
|
130
|
+
end
|
117
131
|
end
|