Pass a bash array as an argument

I have a bash script in which I’m using an array to get a list of files and I needed to pass the content of this array as an argument, to send an email to some users. This is the array: RAW_LIST="$(echo "ls -1 /download")" declare -a LIST readarray -t LIST <<<"${RAW_LIST}"RAW_LIST="$(echo "ls -1 /download")"… Continue reading “Pass a bash array as an argument”

Check software RAID script

Here’s a Bash script to check software RAID that will send an e-mail reporting the array status: #!/bin/bash # EMAIL=""   if egrep "\[.*_.*\]" /proc/mdstat  > /dev/null then logger -s "mdcheck: RAID devices ERROR" echo "Software RAID devices ERROR on ${HOSTNAME}" | /bin/mail -s \ "$0: Software RAID devices ERROR on ${HOSTNAME}" ${EMAIL} else… Continue reading “Check software RAID script”

Nagios plugin: monitor a systemd service

Here’s a tiny plugin to check if a systemd service is running: #!/bin/bash # # машины # # Check a if a systemd service is running # # Usage: $0 # #Nagios exit codes OK=0 WARNING=1 CRITICAL=2 UNKNOWN=3   SERVICE=$1   # Check service status   systemctl -q is-active $SERVICE if [[ $? -ne 0… Continue reading “Nagios plugin: monitor a systemd service”