diff options
author | Simon Rettberg | 2014-01-10 15:39:54 +0100 |
---|---|---|
committer | Simon Rettberg | 2014-01-10 15:39:54 +0100 |
commit | d1066678b367942a74ab8c93e65f7bd29b7e3a92 (patch) | |
tree | bbbeaf4c477d780530a3a538df3235cb31968d12 /remote/rootfs/rootfs-stage32/data | |
parent | [rfs-stage31] Don't wait for br0 up if /sys/.../operstate doesn't exist (diff) | |
download | tm-scripts-d1066678b367942a74ab8c93e65f7bd29b7e3a92.tar.gz tm-scripts-d1066678b367942a74ab8c93e65f7bd29b7e3a92.tar.xz tm-scripts-d1066678b367942a74ab8c93e65f7bd29b7e3a92.zip |
[smartctl] Also parse health status reported by drive
Diffstat (limited to 'remote/rootfs/rootfs-stage32/data')
-rwxr-xr-x | remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog index afe72a2d..b80d55cf 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog @@ -47,18 +47,27 @@ if [ $# -lt 2 ]; then else MSG="$2" fi -MSG="[$(whoami)] $MSG" +USER=$(whoami) +MSG="[$USER] $MSG" if [ $# -gt 2 ]; then EXTRA="$3" fi -if [ -n "$EXTRA" ] && [ -r "$EXTRA" -a -s "$EXTRA" ] && [ "$(stat -c %s "$EXTRA")" -lt "10000" ]; then - curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc@$EXTRA" "$SLX_REMOTE_LOG" > /dev/null 2>&1 & -elif [ -n "$EXTRA" ]; then - curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc=Missing/too large: $EXTRA" "$SLX_REMOTE_LOG" > /dev/null 2>&1 & +if [ -n "$SLX_DEBUG" ]; then + CURLLOG="/tmp/slxlog.$USER" else - curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" "$SLX_REMOTE_LOG" > /dev/null 2>&1 & + CURLLOG="/dev/null" +fi + +if [ -n "$EXTRA" ] && [ -r "$EXTRA" -a -s "$EXTRA" ] && [ "$(stat -c %s "$EXTRA")" -lt "10000" ]; then # valid file attachment + curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc@$EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 & +elif [ -z "$EXTRA" ]; then # no attachment + curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 & +elif [ -s "$EXTRA" ]; then # empty attachment file (or missing) + curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc=Attachment too large: $EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 & +else # attachment file to big (more than 10k) + curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc=Attachment missing/empty: $EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 & fi exit 0 |