<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Send Custom Notifications from scripts running on a Synology [new]	</title>
	<atom:link href="https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/</link>
	<description>The Joys of Computing</description>
	<lastBuildDate>Mon, 07 Jul 2025 12:47:27 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8</generator>
	<item>
		<title>
		By: Jan		</title>
		<link>https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-9986</link>

		<dc:creator><![CDATA[Jan]]></dc:creator>
		<pubDate>Mon, 07 Jul 2025 12:47:27 +0000</pubDate>
		<guid isPermaLink="false">/wordpress/?p=2740#comment-9986</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-9985&quot;&gt;Jan&lt;/a&gt;.

okay copy pasting with the quotes worked above, but identation was removed by this crappy forum.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-9985">Jan</a>.</p>
<p>okay copy pasting with the quotes worked above, but identation was removed by this crappy forum.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jan		</title>
		<link>https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-9985</link>

		<dc:creator><![CDATA[Jan]]></dc:creator>
		<pubDate>Mon, 07 Jul 2025 12:44:45 +0000</pubDate>
		<guid isPermaLink="false">/wordpress/?p=2740#comment-9985</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-300&quot;&gt;Nigel Bartlett&lt;/a&gt;.

After some quote syntax error, probably because of this crappy forum website, it actually works even on DSM 7.2.2-72806 Update 3.

I fixed and beautified it (hopefully copy pasting it works on this website):
#!/bin/bash

# Send a notification email via the NAS. Parameters are: TAG_EVENT VARLIST value1 value2 value3 …
# Tested on DSM 6.2.4-25556 Update 6 and DSM 7.1.1-42962 Update 2

function nas_notify() {
  # TAG_EVENT names the email template to be used (see /usr/syno/synoman/webman/texts/enu/mails for the English list)
  local TAG_EVENT=$1
  
  # VARLIST is the list of variables used in the email template (without the surrounding % signs)
  # Note: Some variables, eg HOSTNAME, are set by the NAS and shouldn’t be included here
  local VARLIST=$2
  
  # The values to be assigned to the variables in the above list are in $3 $4 $5 …
  local NTFYJSON=&quot;&quot;
  local V VAL
  
  # Values start at this parameter
  local I=3
  
  # This command does the notify
  local NTFY_CMD=&quot;/usr/syno/bin/synonotify&quot;
  
  # Create the variable/value list in almost JSON format. The NAS surrounds each variable name with % signs so we do, too
  if [ &quot;$VARLIST&quot; != &quot;&quot; ]; then
    for V in $VARLIST; do
      eval VAL=\$$I
      NTFYJSON=&quot;${NTFYJSON},\&quot;%${V}%\&quot;: \&quot;${VAL}\&quot;&quot;
      I=$((I + 1))
    done
	
    # Drop the leading comma from NTFYJSON and enclose the result in braces for actual JSON
    NTFYJSON=&quot;{${NTFYJSON:1}}&quot;
  fi
  [ -x &quot;$NTFY_CMD&quot; ] &#038;&#038; &quot;$NTFY_CMD&quot; &quot;$TAG_EVENT&quot; &quot;$NTFYJSON&quot;
}

nas_notify &quot;ShareSyncError&quot; &quot;S2S_SERVER S2S_TASK DUR&quot; &quot;${BASH_SOURCE[0]}&quot; &quot;Message about the failure&quot; &quot;0 days 0 hours 0 mins 1 secs&quot;

exit $?]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-300">Nigel Bartlett</a>.</p>
<p>After some quote syntax error, probably because of this crappy forum website, it actually works even on DSM 7.2.2-72806 Update 3.</p>
<p>I fixed and beautified it (hopefully copy pasting it works on this website):<br />
#!/bin/bash</p>
<p># Send a notification email via the NAS. Parameters are: TAG_EVENT VARLIST value1 value2 value3 …<br />
# Tested on DSM 6.2.4-25556 Update 6 and DSM 7.1.1-42962 Update 2</p>
<p>function nas_notify() {<br />
  # TAG_EVENT names the email template to be used (see /usr/syno/synoman/webman/texts/enu/mails for the English list)<br />
  local TAG_EVENT=$1</p>
<p>  # VARLIST is the list of variables used in the email template (without the surrounding % signs)<br />
  # Note: Some variables, eg HOSTNAME, are set by the NAS and shouldn’t be included here<br />
  local VARLIST=$2</p>
<p>  # The values to be assigned to the variables in the above list are in $3 $4 $5 …<br />
  local NTFYJSON=&#8221;&#8221;<br />
  local V VAL</p>
<p>  # Values start at this parameter<br />
  local I=3</p>
<p>  # This command does the notify<br />
  local NTFY_CMD=&#8221;/usr/syno/bin/synonotify&#8221;</p>
<p>  # Create the variable/value list in almost JSON format. The NAS surrounds each variable name with % signs so we do, too<br />
  if [ &#8220;$VARLIST&#8221; != &#8220;&#8221; ]; then<br />
    for V in $VARLIST; do<br />
      eval VAL=\$$I<br />
      NTFYJSON=&#8221;${NTFYJSON},\&#8221;%${V}%\&#8221;: \&#8221;${VAL}\&#8221;&#8221;<br />
      I=$((I + 1))<br />
    done</p>
<p>    # Drop the leading comma from NTFYJSON and enclose the result in braces for actual JSON<br />
    NTFYJSON=&#8221;{${NTFYJSON:1}}&#8221;<br />
  fi<br />
  [ -x &#8220;$NTFY_CMD&#8221; ] &amp;&amp; &#8220;$NTFY_CMD&#8221; &#8220;$TAG_EVENT&#8221; &#8220;$NTFYJSON&#8221;<br />
}</p>
<p>nas_notify &#8220;ShareSyncError&#8221; &#8220;S2S_SERVER S2S_TASK DUR&#8221; &#8220;${BASH_SOURCE[0]}&#8221; &#8220;Message about the failure&#8221; &#8220;0 days 0 hours 0 mins 1 secs&#8221;</p>
<p>exit $?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Wolle		</title>
		<link>https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-4500</link>

		<dc:creator><![CDATA[Wolle]]></dc:creator>
		<pubDate>Sun, 03 Nov 2024 21:38:15 +0000</pubDate>
		<guid isPermaLink="false">/wordpress/?p=2740#comment-4500</guid>

					<description><![CDATA[This worked with DSM 7.2.1.
There are two predefined custom messages  for severity info and error.
Might be used by calling from script e.g.:
  /usr/syno/bin/synonotify DSMSupportFormCustomFailure &#039;{ &quot;%CUSTOM_MSG%&quot; : &quot;my script xy ended with failure yz&quot; }&#039;

Definition snipped from /usr/syno/synoman/webman/texts/enu/mail:

[DSMSupportFormCustomFailure]
Category: System
Level: NOTIFICATION_ERROR
Desktop: %CUSTOM_MSG%.

[DSMSupportFormCustomMessage]
Category: System
Level: NOTIFICATION_INFO
Desktop: %CUSTOM_MSG%.]]></description>
			<content:encoded><![CDATA[<p>This worked with DSM 7.2.1.<br />
There are two predefined custom messages  for severity info and error.<br />
Might be used by calling from script e.g.:<br />
  /usr/syno/bin/synonotify DSMSupportFormCustomFailure &#8216;{ &#8220;%CUSTOM_MSG%&#8221; : &#8220;my script xy ended with failure yz&#8221; }&#8217;</p>
<p>Definition snipped from /usr/syno/synoman/webman/texts/enu/mail:</p>
<p>[DSMSupportFormCustomFailure]<br />
Category: System<br />
Level: NOTIFICATION_ERROR<br />
Desktop: %CUSTOM_MSG%.</p>
<p>[DSMSupportFormCustomMessage]<br />
Category: System<br />
Level: NOTIFICATION_INFO<br />
Desktop: %CUSTOM_MSG%.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Matt		</title>
		<link>https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-302</link>

		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Mon, 02 Oct 2023 03:18:28 +0000</pubDate>
		<guid isPermaLink="false">/wordpress/?p=2740#comment-302</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-300&quot;&gt;Nigel Bartlett&lt;/a&gt;.

Unfortunately this doesn&#039;t seem to work with DSM 7.2]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-300">Nigel Bartlett</a>.</p>
<p>Unfortunately this doesn&#8217;t seem to work with DSM 7.2</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Valery Letroye		</title>
		<link>https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-301</link>

		<dc:creator><![CDATA[Valery Letroye]]></dc:creator>
		<pubDate>Sun, 06 Nov 2022 09:30:51 +0000</pubDate>
		<guid isPermaLink="false">/wordpress/?p=2740#comment-301</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-300&quot;&gt;Nigel Bartlett&lt;/a&gt;.

Thx a lot for sharing!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-300">Nigel Bartlett</a>.</p>
<p>Thx a lot for sharing!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Nigel Bartlett		</title>
		<link>https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-300</link>

		<dc:creator><![CDATA[Nigel Bartlett]]></dc:creator>
		<pubDate>Thu, 03 Nov 2022 14:24:07 +0000</pubDate>
		<guid isPermaLink="false">/wordpress/?p=2740#comment-300</guid>

					<description><![CDATA[Hi, I wrote a bash function to call synonotify (below).  I have tested it on DSM 6.2 and DSM 7.1.

#!/bin/bash

# Send a notification email via the NAS. Parameters are: TAG_EVENT VARLIST value1 value2 value3 ...
# Tested on DSM 6.2.4-25556 Update 6 and DSM 7.1.1-42962 Update 2
function nas_notify()
{
# TAG_EVENT names the email template to be used (see /usr/syno/synoman/webman/texts/enu/mails for the English list)
  local TAG_EVENT=${1}
# VARLIST is the list of variables used in the email template (without the surrounding % signs)
# Note: Some variables, eg HOSTNAME, are set by the NAS and shouldn&#039;t be included here
  local VARLIST=${2}
# The values to be assigned to the variables in the above list are in $3 $4 $5 ...
  local NTFYJSON V VAL
# Values start at this parameter
  local I=3
# This command does the notify
  local NTFY_CMD=&quot;/usr/syno/bin/synonotify&quot;
# Create the variable/value list in almost JSON format.  The NAS surrounds each variable name with % signs so we do, too
  if [ &quot;${VARLIST}&quot; != &quot;&quot; ]; then
    for V in ${VARLIST}; do
      eval VAL=\$$I
      NTFYJSON=&quot;${NTFYJSON},&#039;%${V}%&#039;: &#039;${VAL}&#039;&quot;
      I=$(( I + 1 ))
    done
# Drop the leading comma from NTFYJSON and enclose the result in braces for actual JSON
    NTFYJSON=&quot;{${NTFYJSON:1}}&quot;
  fi
  [ -x &quot;${NTFY_CMD}&quot; ] &#038;&#038; ${NTFY_CMD} &quot;${TAG_EVENT}&quot; &quot;${NTFYJSON}&quot;
}

nas_notify &quot;ShareSyncError&quot; &quot;S2S_SERVER S2S_TASK DUR&quot; &quot;${BASH_SOURCE[0]}&quot; &quot;Message about the failure&quot; &quot;0 days 0 hours 0 mins 1 secs&quot;

exit $?]]></description>
			<content:encoded><![CDATA[<p>Hi, I wrote a bash function to call synonotify (below).  I have tested it on DSM 6.2 and DSM 7.1.</p>
<p>#!/bin/bash</p>
<p># Send a notification email via the NAS. Parameters are: TAG_EVENT VARLIST value1 value2 value3 &#8230;<br />
# Tested on DSM 6.2.4-25556 Update 6 and DSM 7.1.1-42962 Update 2<br />
function nas_notify()<br />
{<br />
# TAG_EVENT names the email template to be used (see /usr/syno/synoman/webman/texts/enu/mails for the English list)<br />
  local TAG_EVENT=${1}<br />
# VARLIST is the list of variables used in the email template (without the surrounding % signs)<br />
# Note: Some variables, eg HOSTNAME, are set by the NAS and shouldn&#8217;t be included here<br />
  local VARLIST=${2}<br />
# The values to be assigned to the variables in the above list are in $3 $4 $5 &#8230;<br />
  local NTFYJSON V VAL<br />
# Values start at this parameter<br />
  local I=3<br />
# This command does the notify<br />
  local NTFY_CMD=&#8221;/usr/syno/bin/synonotify&#8221;<br />
# Create the variable/value list in almost JSON format.  The NAS surrounds each variable name with % signs so we do, too<br />
  if [ &#8220;${VARLIST}&#8221; != &#8220;&#8221; ]; then<br />
    for V in ${VARLIST}; do<br />
      eval VAL=\$$I<br />
      NTFYJSON=&#8221;${NTFYJSON},&#8217;%${V}%&#8217;: &#8216;${VAL}'&#8221;<br />
      I=$(( I + 1 ))<br />
    done<br />
# Drop the leading comma from NTFYJSON and enclose the result in braces for actual JSON<br />
    NTFYJSON=&#8221;{${NTFYJSON:1}}&#8221;<br />
  fi<br />
  [ -x &#8220;${NTFY_CMD}&#8221; ] &amp;&amp; ${NTFY_CMD} &#8220;${TAG_EVENT}&#8221; &#8220;${NTFYJSON}&#8221;<br />
}</p>
<p>nas_notify &#8220;ShareSyncError&#8221; &#8220;S2S_SERVER S2S_TASK DUR&#8221; &#8220;${BASH_SOURCE[0]}&#8221; &#8220;Message about the failure&#8221; &#8220;0 days 0 hours 0 mins 1 secs&#8221;</p>
<p>exit $?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: TKruzze		</title>
		<link>https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-299</link>

		<dc:creator><![CDATA[TKruzze]]></dc:creator>
		<pubDate>Mon, 01 Nov 2021 01:08:13 +0000</pubDate>
		<guid isPermaLink="false">/wordpress/?p=2740#comment-299</guid>

					<description><![CDATA[This was such a great solution for DSM 6.x, However, I can&#039;t figure out how to make it work under 7.0. I recent;y upgraded my NAS from a DS416 to a 920+ and decided to install 7.0 fresh.  So much has changed and despite many attempts and many reboots, I&#039;m not able to add any new Notifications to DSM 7.0. I even tried the suggestions from Daniel Goepp and that didn&#039;t work for me, either.

Anyway, thanks for putting this out there! If, and when, you make the move to DSM 7.x, I do hope you&#039;ll share any solutions you come up with. I feel absolutely lost without it. Hijacking an used notification works, to a degree, but I really miss having the Desktop notification flow displaying my custom details.]]></description>
			<content:encoded><![CDATA[<p>This was such a great solution for DSM 6.x, However, I can&#8217;t figure out how to make it work under 7.0. I recent;y upgraded my NAS from a DS416 to a 920+ and decided to install 7.0 fresh.  So much has changed and despite many attempts and many reboots, I&#8217;m not able to add any new Notifications to DSM 7.0. I even tried the suggestions from Daniel Goepp and that didn&#8217;t work for me, either.</p>
<p>Anyway, thanks for putting this out there! If, and when, you make the move to DSM 7.x, I do hope you&#8217;ll share any solutions you come up with. I feel absolutely lost without it. Hijacking an used notification works, to a degree, but I really miss having the Desktop notification flow displaying my custom details.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Matt		</title>
		<link>https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-298</link>

		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Sun, 31 Oct 2021 04:31:31 +0000</pubDate>
		<guid isPermaLink="false">/wordpress/?p=2740#comment-298</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-297&quot;&gt;Matt&lt;/a&gt;.

Sorry, quick correction - the additional single quotes worked in the CLI, but I had to add an extra layer of double quotes to work inside the bash script.

So my successful implementation was as follows:
/usr/syno/bin/synonotify tag_event &#039;{&quot;%VAR%&quot;: &quot;&#039;&quot;$var&quot;&#039;&quot;}&#039;]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-297">Matt</a>.</p>
<p>Sorry, quick correction &#8211; the additional single quotes worked in the CLI, but I had to add an extra layer of double quotes to work inside the bash script.</p>
<p>So my successful implementation was as follows:<br />
/usr/syno/bin/synonotify tag_event &#8216;{&#8220;%VAR%&#8221;: &#8220;&#8216;&#8221;$var&#8221;&#8216;&#8221;}&#8217;</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Matt		</title>
		<link>https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-297</link>

		<dc:creator><![CDATA[Matt]]></dc:creator>
		<pubDate>Sun, 31 Oct 2021 04:05:38 +0000</pubDate>
		<guid isPermaLink="false">/wordpress/?p=2740#comment-297</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-294&quot;&gt;Valery Letroye&lt;/a&gt;.

The additional single quotes around the variable fixed this for me, thanks!]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-294">Valery Letroye</a>.</p>
<p>The additional single quotes around the variable fixed this for me, thanks!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Valery Letroye		</title>
		<link>https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-296</link>

		<dc:creator><![CDATA[Valery Letroye]]></dc:creator>
		<pubDate>Sun, 03 Oct 2021 15:22:46 +0000</pubDate>
		<guid isPermaLink="false">/wordpress/?p=2740#comment-296</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-295&quot;&gt;Alessio&lt;/a&gt;.

I never tried myself... 

But: as users may subscribe (or not) on events to be notified, via Control Panel &gt; Notifications &gt; Advanced
I would suggest that: if you want only one user to be notified, tell that one only to subscribe on your custom notifications.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://www.BeatificaBytes.be/send-custom-notifications-from-scripts-running-on-a-synology-new/#comment-295">Alessio</a>.</p>
<p>I never tried myself&#8230; </p>
<p>But: as users may subscribe (or not) on events to be notified, via Control Panel > Notifications > Advanced<br />
I would suggest that: if you want only one user to be notified, tell that one only to subscribe on your custom notifications.</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
