From ceea2eb19e1e7d27c0e41d055ce7a3f09a95a86a Mon Sep 17 00:00:00 2001 From: Andrew DeFaria Date: Fri, 4 Jun 2021 11:40:29 -0700 Subject: [PATCH] Hopefully .gitignore will remain now Also updated a few bins --- .gitignore | 1 + bin/announceEmail.pl | 20 +++++++++++++++++--- bin/update-system | 2 +- 3 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7c18c6b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.pydevproject diff --git a/bin/announceEmail.pl b/bin/announceEmail.pl index d21003b..96da982 100755 --- a/bin/announceEmail.pl +++ b/bin/announceEmail.pl @@ -105,6 +105,9 @@ my @greetings = ( "What's this? A new message", ); +my $icon = '/home/andrew/.icons/Thunderbird.jpg'; +my $timeout = 5 * 1000; + my %opts = ( usage => sub { pod2usage }, help => sub { pod2usage(-verbose => 2)}, @@ -116,12 +119,20 @@ my %opts = ( imap => $defaultIMAPServer, ); +sub notify($) { + my ($msg) = @_; + + my $cmd = "notify-send -i $icon -t $timeout '$msg'"; + + Execute $cmd; +} # notify + sub interrupted { if (get_debug) { - $log->msg("Turning off debugging"); + notify 'Turning off debugging'; set_debug 0; } else { - $log->msg("Turning on debugging"); + notify ('Turning on debugging'); set_debug 1; } # if @@ -131,7 +142,10 @@ sub interrupted { sub Connect2IMAP; sub restart { - $log->dbug("Re-establishing connection to $opts{imap} as $opts{username}"); + my $msg = "Re-establishing connection to $opts{imap} as $opts{username}"; + + $log->dbug($msg); + Connect2IMAP; goto MONITORMAIL; diff --git a/bin/update-system b/bin/update-system index 864edf0..79d3d1c 100755 --- a/bin/update-system +++ b/bin/update-system @@ -11,7 +11,7 @@ uptodate=$(grep -v "^Listing" $tmpfile | wc -l) if [ $uptodate -ne 0 ]; then cat $tmpfile >> $logfile && rm $tmpfile - + apt-get upgrade -y >> $tmpfile held_back=$(grep "kept back" $tmpfile | wc -l) -- 2.17.1