Skip to content

Commit

Permalink
optimized cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
HMside authored and HMside committed Apr 9, 2017
1 parent e4b9096 commit 696ce19
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 15 deletions.
23 changes: 15 additions & 8 deletions addon/email
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set testing "0"

#######################################
# HMside #
# 02.2017 #
# 04.2017 #
#######################################

package require base64
Expand All @@ -17,9 +17,14 @@ if { [ catch {
set LOGFILE "/var/log/email.log"

# CLEAN UP
exec rm -r /usr/local/etc/config/addons/email/tmp
exec mkdir /usr/local/etc/config/addons/email/tmp/
exec chmod 755 /usr/local/etc/config/addons/email/tmp/
if { [file exists /usr/local/etc/config/addons/email/tmp] == 1} {
exec rm -r /usr/local/etc/config/addons/email/tmp
exec mkdir /usr/local/etc/config/addons/email/tmp/
exec chmod 755 /usr/local/etc/config/addons/email/tmp/
} else {
exec mkdir /usr/local/etc/config/addons/email/tmp/
exec chmod 755 /usr/local/etc/config/addons/email/tmp/
}

# LOAD
proc __loadFromFile { filename } {
Expand Down Expand Up @@ -128,7 +133,7 @@ if {$AttName == "messages"} {
}

if {$mail(AttType) == "snapshot"} {
set AttNewName "snapshot-$date.jpg"
set AttNewName "snapshot-$date.jpg"
} elseif {$mail(AttType) == "snapshot1"} {
set AttNewName "snapshot-$date.jpg"
} elseif {$mail(AttType) == "off"} {
Expand Down Expand Up @@ -275,9 +280,11 @@ close $fp
exec cat /usr/local/etc/config/addons/email/tmp/ready.eml | /usr/local/etc/config/addons/email/msmtp -t -C /etc/config/addons/email/msmtp.conf

# CLEAN UP
exec rm -r /usr/local/etc/config/addons/email/tmp
exec mkdir /usr/local/etc/config/addons/email/tmp/
exec chmod 755 /usr/local/etc/config/addons/email/tmp/
if { [file exists /usr/local/etc/config/addons/email/tmp] == 1} {
exec rm -r /usr/local/etc/config/addons/email/tmp
#exec mkdir /usr/local/etc/config/addons/email/tmp/
#exec chmod 755 /usr/local/etc/config/addons/email/tmp/
}

} errMsg ] } then {
exec -- logger -t email -p user.err $errMsg
Expand Down
21 changes: 14 additions & 7 deletions ccu1/email
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set testing "0"

#######################################
# HMside #
# 02.2017 #
# 04.2017 #
#######################################

package require base64
Expand All @@ -17,9 +17,14 @@ if { [ catch {
set LOGFILE "/var/log/email.log"

# CLEAN UP
exec rm -r /usr/local/etc/config/addons/email/tmp
exec mkdir /usr/local/etc/config/addons/email/tmp/
exec chmod 755 /usr/local/etc/config/addons/email/tmp/
if { [file exists /usr/local/etc/config/addons/email/tmp] == 1} {
exec rm -r /usr/local/etc/config/addons/email/tmp
exec mkdir /usr/local/etc/config/addons/email/tmp/
exec chmod 755 /usr/local/etc/config/addons/email/tmp/
} else {
exec mkdir /usr/local/etc/config/addons/email/tmp/
exec chmod 755 /usr/local/etc/config/addons/email/tmp/
}

# LOAD
proc __loadFromFile { filename } {
Expand Down Expand Up @@ -275,9 +280,11 @@ close $fp
exec cat /usr/local/etc/config/addons/email/tmp/ready.eml | /usr/local/etc/config/addons/email/msmtp -t -C /etc/config/addons/email/msmtp.conf

# CLEAN UP
exec rm -r /usr/local/etc/config/addons/email/tmp
exec mkdir /usr/local/etc/config/addons/email/tmp/
exec chmod 755 /usr/local/etc/config/addons/email/tmp/
if { [file exists /usr/local/etc/config/addons/email/tmp] == 1} {
exec rm -r /usr/local/etc/config/addons/email/tmp
#exec mkdir /usr/local/etc/config/addons/email/tmp/
#exec chmod 755 /usr/local/etc/config/addons/email/tmp/
}

} errMsg ] } then {
exec -- logger -t email -p user.err $errMsg
Expand Down

0 comments on commit 696ce19

Please sign in to comment.