When the Path is available, the share is there.
That is provably incorrect. Starting with the Plex share mounted and its contents available:
root@NAS:~# mount | grep Plex
/volume1/@Plex@ on /volume1/Plex type ecryptfs (rw,relatime,ecryptfs_fnek_sig=...
root@NAS:~# ll /volume1/Plex
total 48
d---------+ 1 root root 2176 May 21 10:21 .
drwxr-xr-x 1 root root 446 May 28 07:07 ..
-rwx------+ 1 plex users 0 May 25 12:53 Bitte legen Sie hier keine Mediendateien ab.
drwxrwxrwx+ 1 root root 336 May 28 07:07 @eaDir
drwx------+ 1 plex users 208 May 16 11:34 Library
-rwx------+ 1 plex users 0 May 25 12:53 Please do not place any media files here.
-rwx------+ 1 plex users 0 May 25 12:53 Por favor, no coloque ningún archivo multimedia aquí.
drwx------+ 1 plex users 0 May 28 07:05 tmp_transcoding
-rwx------+ 1 plex users 0 May 25 12:53 Veuillez ne placer aucun fichier multimédia ici.
-rwx------+ 1 plex users 0 May 25 12:53 ここにメディアファイルを置かないでください。
-rwx------+ 1 plex users 0 May 25 12:53 请不要在此处放置任何媒体文件。
root@NAS:~# synoshare --get Plex
SYNOSHARE data dump:
Name .......[Plex]
Comment ....[Plex metadata storage]
Path .......[/volume1/Plex]
Deny list ..[]
RW list ....[]
RO list ....[]
fType ......[2]
fBrowseable [yes]
FTPPrivilege[7]
Status .....[0x1882]
WinShare .....[yes]
ACL ..........[yes]
Skip smb perm.[yes]
Permit .......[yes]
RecycleBin....[no]
RecycleBinAdminOnly....[no]
HideUnreadable ........[no]
Snapshot browsing .....[no]
On Cold Storage Volume.....[no]
root@NAS:~#
So now I’ll unmount the encrypted Plex share:
root@NAS:~# synoshare --enc_unmount Plex
root@NAS:~# ll /volume1/Plex
ls: cannot access /volume1/Plex: No such file or directory
root@NAS:~# synoshare --get Plex
SYNOSHARE data dump:
Name .......[Plex]
Comment ....[Plex metadata storage]
Path .......[/volume1/Plex]
Deny list ..[]
RW list ....[]
RO list ....[]
fType ......[2]
fBrowseable [yes]
FTPPrivilege[7]
Status .....[0x1883]
WinShare .....[yes]
ACL ..........[yes]
Skip smb perm.[yes]
Permit .......[yes]
RecycleBin....[no]
RecycleBinAdminOnly....[no]
HideUnreadable ........[no]
Snapshot browsing .....[no]
On Cold Storage Volume.....[no]
root@NAS:~#
Note that when the Plex share is unmounted, and in fact the /volume1/Plex directory does not even exist, synoshare --get Plex still shows the full Path. So the presence of the Path in the output of synoshare --get Plex has nothing to do with whether the share is available for use or not.
This is why my suggested script modification uses the Status value from synoshare --get Plex. Note the difference in the Status value between the mounted case and the unmounted case:
root@NAS:~# mount | grep -i plex
root@NAS:~# synoshare --get Plex | grep Status
Status .....[0x1883]
root@NAS:~# synoshare --enc_mount Plex 'password_redacted'
root@NAS:~# mount | grep -i plex
/volume1/@Plex@ on /volume1/Plex type ecryptfs (rw,relatime,ecryptfs_fnek_sig=...
root@NAS:~# synoshare --get Plex | grep Status
Status .....[0x1882]
root@NAS:~#
When unmounted, the Status is 0x1883 (an odd number, so the LSB is set). When mounted, the Status is 0x1882 (an even number, so the LSB is not set). That same pattern holds for all other shares, encrypted and not, on my NAS.