瀏覽代碼

Add custom command for notification

tags/1.7b1
Azlux 5 月之前
父節點
當前提交
dc2dd2dbad
共有 3 個檔案被更改,包括 12 行新增5 行删除
  1. +1
    -1
      build-packages.sh
  2. +4
    -2
      log2ram
  3. +7
    -2
      log2ram.conf

+ 1
- 1
build-packages.sh 查看文件

@@ -13,7 +13,7 @@ DESTDIR="$STARTDIR/pkg"
OUTDIR="$STARTDIR/deb"
# get version
repo="azlux/log2ram"
api=$(curl --silent "https://api.github.com/repos/$repo/releases/latest")
api=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq ".[0]")
new=$(echo $api | grep -Po '"tag_name": "\K.*?(?=")')

# Remove potential leftovers from a previous build


+ 4
- 2
log2ram 查看文件

@@ -8,6 +8,8 @@ fi

LOG_NAME='log2ram.log'
NO_RSYNC=${USE_RSYNC#true}
NOTIFICATION_COMMAND=${NOTIFICATION_COMMAND:=mail -s "Log2Ram Error on $HOSTNAME" root}
NOTIFICATION=${NOTIFICATION:=true}

## @fn is_safe()
## @brief Check if hdd log exists
@@ -66,8 +68,8 @@ sync_from_disk() {
echo -e "File(s) causing issues\n: $(du -sh -t "$TP_SIZE" "$HDD_LOG"/*)"
umount -l "$RAM_LOG"/
umount -l "$HDD_LOG"/
if [ "$MAIL" = true ]; then
echo "LOG2RAM : No place on RAM for \"$HDD_LOG/\" anymore, fallback on the disk" | mail -s 'Log2Ram Error' root
if [ "$NOTIFICATION" = true ]; then
echo "LOG2RAM : No place on RAM for \"$HDD_LOG/\" anymore, fallback on the disk" | $NOTIFICATION_COMMAND
fi
exit 1
fi


+ 7
- 2
log2ram.conf 查看文件

@@ -14,9 +14,14 @@ SIZE=128M
# In all other cases, setting USE_RSYNC to anything other than true will default to "cp".
#USE_RSYNC=false

# If there are some errors with available RAM space, a system mail will be send
# If there are some errors with available RAM space, a system mail will be send by default (see next parameter)
# Change it to false and you will have only a log if there is no place on RAM anymore.
MAIL=true
#NOTIFICATION=true

# This is a one-line command for the error notification.
# By default, it's a email with the command `mail`, the body is passed in stdin.
# So you can set any command(like shoutrrr) or custom script for the error notification.
#NOTIFICATION_COMMAND=mail -s "Log2Ram Error on $HOSTNAME"

# Variable for folders to put in RAM. You need to specify the real folder `/path/folder` , the `/path/hdd.folder` will
# be automatically created. Multiple path can be separeted by `;`. Do not add the final `/` !


Loading…
取消
儲存