diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2017-01-26 01:20:44 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2017-01-26 01:28:01 -0500 |
commit | 12b695954ac2c34d9dba43081e7f852e31c2b3ec (patch) | |
tree | 4bd39dade0ead0cf19a562b30bdecdf6d589f6b2 | |
parent | 29bbc978760a4a56e27d5fdb41e78fee0f62e186 (diff) |
remove offlineimap programs; obviated by systemd
-rw-r--r-- | .gitignore | 2 | ||||
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | offlineimap-killer.sh | 33 | ||||
-rw-r--r-- | offlineimap-runner.sh | 11 |
4 files changed, 0 insertions, 48 deletions
@@ -7,8 +7,6 @@ chardiff_post daemon hangman-helper maildups -offlineimap-killer -offlineimap-runner ord roll tempmon @@ -17,8 +17,6 @@ BINFILES = \ daemon \ hangman-helper \ maildups \ - offlineimap-killer \ - offlineimap-runner \ ord \ roll \ tempmon \ diff --git a/offlineimap-killer.sh b/offlineimap-killer.sh deleted file mode 100644 index c0cebd7..0000000 --- a/offlineimap-killer.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# Copyright (C) 2014-2015 Luke Shumaker <lukeshu@sbcglobal.net> - -# Usage: offlineimap-killer LIMIT -# -# Kills any instance of offlineimap that has been running longer than -# LIMIT seconds. - -pid_uptime() { - local pid=$1 - local sec_uptime=$(cut -d ' ' -f1 /proc/uptime) - local tic_started_at - tic_started_at=$(cut -d ' ' -f 22 /proc/${pid}/stat 2>/dev/null) || - { echo 0; return 0; } - local tic_per_sec=$(getconf CLK_TCK) - - bc <<<"${sec_uptime} - (${tic_started_at}/${tic_per_sec})" -} - -main() { - declare -i limit=$1 - local pids=($(pgrep -x offlineimap)) - local pid - for pid in "${pids[@]}"; do - declare -i uptime=$(pid_uptime $pid|cut -d. -f1) - if [[ "$uptime" -gt "$pid" ]]; then - printf 'Killing %d which has been running for %d seconds' "$pid" "$uptime" - kill -9 "$pid" - fi - done -} - -main "$@" diff --git a/offlineimap-runner.sh b/offlineimap-runner.sh deleted file mode 100644 index c22e776..0000000 --- a/offlineimap-runner.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash -# Copyright (C) 2013-2014 Luke Shumaker <lukeshu@sbcglobal.net> - -# Run offline imap, but "parse" the output to generate a sane exit status - -output_file="$(mktemp --tmpdir "${0##*/}.XXXXXXXXXX")" -trap "rm -f $(printf '%q' "$output_file")" EXIT - -offlineimap "$@" |& tee "$output_file" - -! grep -q '^ERROR:' -- "$output_file" |