Sfoglia il codice sorgente

Add custom command for notification

tags/1.7b1
Azlux 5 mesi fa
parent
commit
dc2dd2dbad
3 ha cambiato i file con 12 aggiunte e 5 eliminazioni
  1. +1
    -1
      build-packages.sh
  2. +4
    -2
      log2ram
  3. +7
    -2
      log2ram.conf

+ 1
- 1
build-packages.sh Vedi File

@@ -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 Vedi File

@@ -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 Vedi File

@@ -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 `/` !


Caricamento…
Annulla
Salva