Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[SOLVED] Slack/Email notifications on array start at boot, v6.8.3

Featured Replies

Hello! I had been dealing with an issue and finally found a solution, I don't know if this is the best solution but it does get the job done. I really couldn't find anything when searching google or this forum that addresses what I was experiencing below and so I thought I would just create this post so it's out here on the internet for others.

 

I'm using User Scripts to send me notifications in Slack when my array is stopped and started for any reason, I specifically wanted to know this for reboots. The events I configured my script for is "At Startup of Array" and "At Stopping of Array".  There's also a "At First Array Start Only" if you want to narrow this down a boot up only alert.

 

The issue I ran into is that the notifications which send over the internet worked in every case where the array was stopped and started except on system boot up. I finally realized this is because it's not guaranteed that internet connectivity will be available at the moment "At Startup of Array" triggers in User Scripts.

 

The solution I implemented in my startup event is a bash 'until' condition which pings google.com one time every second and greps for a positive result, when the script confirms DNS resolution and IPv4 connectivity are both working then the script continues. I implemented some extra stuff so that if the server ever boots without internet connectivity (ISP actually down, etc) then it won't try to ping forever.

 

Script for "At Stopping of Array" is straight forward.

/usr/local/emhttp/webGui/scripts/notify -s "unRAID Array STOPPED." -i "alert" -m "unRAID array has stopped, plex is down."  -d "unRAID array has stopped, plex is down."

 

Script for "At Startup of Array" requires extra steps.

The 'maxpings' variable is the number of times the script will check for internet connectivity and then exits. There's a 1 second sleep between each try. 300 checks means it'll try for about 5 minutes, based on my own system it could take up to 1m 45s to fully boot with web server up, so it seemed like a decent default, adjust as needed.

maxpings=300
numpings=0
until [[ $(ping -q -W 1 -c 1 google.com | grep '1 received' -o) == "1 received" ]]
do
    sleep 1s
    ((numpings=numpings+1))
    if [ $numpings -gt $maxpings ]
    then
        exit 1
    fi
done

/usr/local/emhttp/webGui/scripts/notify -s "unRAID Array STARTED." -i "alert" -m "unRAID array has started, plex will be online momentarily."  -d "unRAID array has started, plex will be online momentarily."

 

Victory!

 

Edited by SixClover

  • JorgeB changed the title to [SOLVED] Slack/Email notifications on array start at boot, v6.8.3
  • 6 months later...

thanks!

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.