Scripting FreeNas via CLI

Status
Not open for further replies.

peconi

Cadet
Joined
Feb 1, 2012
Messages
8
I would like to write some scripts (php/python) that would log into the FreeNas via SSH and issue commands to:
- Create new users/groups
- Create new ZFS Datasets
- Create new CIFS/NFS Shares to these Datasets
- Assign the newly created users/groups to Datasets/Shares

Does anyone know where I could find the info on CLI commands to do this?

Would I also have to be hacking the FreeNas DB in /data folder - or could all this be done simply via CLI. Would definitely like to keep the Gui in sync.

THANKS!
 

ProtoSD

MVP
Joined
Jul 1, 2011
Messages
3,348
You can look at how it's done from the GUI by looking at the Python source in /usr/local/www/

Would I also have to be hacking the FreeNas DB in /data folder - or could all this be done simply via CLI. Would definitely like to keep the Gui in sync.

You would need to update the database in the /data folder, but that's not all that hard either. I wrote a little tutorial in the HowTo section of the forums.

So you would need to understand "sqlite3" and bourne shell (sh/bash)
 

peconi

Cadet
Joined
Feb 1, 2012
Messages
8
Thanks for the info. I'll look into it further now :)

Could I get a direct link to your post in HowTo section please?
 
Status
Not open for further replies.
Top