I have a simple script that erases a volume and them sets the permissions so that anyone can access the drive:
#!/bin/sh
#erase and reformat Volume_name partition
sudo diskutil eraseVolume JHFS+ Volume_name /dev/disk0s4
#change drive permission
sudo chmod o+rw /volumes/Volume_name
If I run these commands separately on terminal on a computer, it works perfectly. However, when I create a script and try to run it through JSS, I get this error:
#!/bin/sh
#erase and reformat Volume_name partition
sudo diskutil eraseVolume JHFS+ Volume_name /dev/disk0s4
Started erase on disk0s4 Volume_name
Unmounting disk
Erasing
Initialized /dev/rdisk0s4 as a 9 GB case-insensitive HFS Plus volume with a 8192k journal
Mounting disk
Could not mount disk0s4 after erase
Finished erase on disk0s4 Volume_name
#change drive permission
sudo chmod o+rw /volumes/Volume_name
chmod: /volumes/Volume_name: No such file or directory
#sudo chmod /volumes/Volume_name
I get why the 2nd command fails (since it didn't mount it can't change permissions), but does anyone know why the first command would repeatedly fail? I've tried flushing the policy so it would try again in case it was just a fluke, but it continually fails at the same spot (re-mounting).