Folks something tells me this is going to be a "D'Oh!" moment, but I'm baffled.
I had a simple requirement to support an ongoing project that requires the creation of a snapshot, and a CIFS share referencing that snapshot, over a series of days. Snapshot and share name naming convention is a simple <YYYYmmdd-<string> and <YYYYmmdd-<string>$>
respectively.
The intention is to create both snapshot/share a little after midnight each day until the project ends and they are no longer needed. Simple enough, right?
Well, when I run these commands via SSH from a prompt on a Linux box, everything works just fine:
Last login time: 10/2/2023 12:26:31
[root@foo01 ~]# /bin/ssh admin@foo 'snapshot show -vserver foo3 -volume Foo04 -snapshot 20231003-foo '
Last login time: 10/2/2023 12:46:12
Vserver: foo3
Volume: Foo04
Snapshot: 20231003-foo
Creation Time: Mon Oct 02 12:46:13 2023
Snapshot Busy: false
List of Owners: -
Snapshot Size: 14.76MB
Percentage of Total Blocks: 0%
Percentage of Used Blocks: 0%
Comment: -
7-Mode Snapshot: false
Label for SnapMirror Operations: -
Snapshot State: -
Constituent Snapshot: false
Expiry Time: 11/2/2023 00:00:00
SnapLock Expiry Time: -
However, running a script (sh or bash, makes no difference in this case), I get this when it runs. It actually doesn't matter what ONTAP command I send, they all give the same "Vserver name: Invalid." error (the
/bin/ssh
lines are just echo statements in the script so I can see that it's building and sending the right command line):
/bin/ssh admin@foo 'snapshot create -vserver foo3 -volume Foo04 -snapshot 20231003-foo -expiry-time 11/02/2023 00:00:00'
Last login time: 10/2/2023 12:46:39
Error: Vserver name: Invalid. The Vserver name must begin with a letter or an
underscore. Maximum supported length: 41 if Vserver is type
"sync-source", 47 otherwise.
/bin/ssh admin@foo 'cifs share create -vserver foo3 -path /Foo04/.snapshot/20231003-foo -share-name 20231003-foo$ -share-properties oplocks,browsable,changenotify,show-previous-versions -symlink-properties
symlinks -offline-files manual -vscan-fileop-profile standard -max-connections-per-share 4294967295 -comment pst migrations ok to delete after 11/02/2023 00:00:00'
Last login time: 10/2/2023 12:51:11
Error: Vserver name: Invalid. The Vserver name must begin with a letter or an
underscore. Maximum supported length: 41 if Vserver is type
"sync-source", 47 otherwise.
The script is so simple it's embarrassing. Define a few variables and optargs, build 3 simple SSH commands to send to the toaster, and run them. Everything up until these commands reach the toaster is working as expected. It just breaks when it gets there.