Virtual Machine Shell Scripts¶
The NIM virtual machine contains a variety of shell scripts to simplify certain administrative tasks. The scripts can be found in:
Most scripts will output instructions for using them by simply running them with no arguments. For example, for instructions on using the nim-media-path script, enter the following from within the /home/nim directory:
Most scripts must be run with “sudo”, which runs them as the root user. You will be prompted for your login password when running a script with sudo.
All example commands assume that the user is running them from within the /home/nim directory.
This script replaces the /etc/network/interfaces file on the NIM VM with a new version of the file based on user input. This is the primary step in making a NIM VM accessible on a local network.
Running this script with no arguments will prompt the user to input an IP address, Netmask, Gateway, and DNS Nameservers. Entering nothing for any of these values sets it to the default for that item, which is shown in parentheses. By default, Network and Broadcast addresses are auto-calculated.
To run this script with no arguments, enter:
To see your /etc/network/interfaces file as it currently is without modifying it and receive instructions for using the script, enter:
sudo ./nim-setup-network -h
To set the network interface to use DHCP, enter:
sudo ./nim-setup-network -d
The nim-media-path script sets the directory where all NIM media is stored. Setting this media path is an important step in setting up NIM for the first time. Typically it is set to a location outside of the NIM VM so the space on the VM isn’t quickly filled with large video or image files uploaded to NIM.
To set NIM’s media path:
sudo ./nim-media-path "/example/media/path"
For example, if you’ve mounted a server named “server1” with VirtualBox:
sudo ./nim-media-path "/media/sf_server1/example/media/path"
When changing NIM’s media path, all existing media will first be copied from the old location to the new location. If the copy is successful, it will delete it from the old location.
The nim-recovery-tool script can assist an admin with gaining access to NIM if all root user passwords are forgotten or if access is denied for any other reason.
The script can:
Reset any NIM user’s password to “password”
List all root usernames
Find a username associated with a specific email address
To reset a user’s password:
sudo ./nim-recovery-tool -u username
To show a list of root users’ usernames:
sudo ./nim-recovery-tool -r
To find a username associated with a known email address:
sudo ./nim-recovery-tool -e email@example.com
The nim-reset-project-structure script disassociates a NIM job from its saved project structure and brings it offline along with all child objects (shows, shots, assets). It can then be associated with a new, different project structure. There is currently no way to accomplish this through the NIM web interface, and it can seriously affect jobs that already have files associated with them through the NIM connectors.
Resetting a job’s project structure does not make any filesystem changes, so project files and folders using the job’s old project structure will be unaffected. However, NIM will have no memory of the old project structure. If the job is brought online with a different project structure, NIM will create the new structure and save files to locations determined by the new structure.
To reset the project structure of job with ID 1234:
sudo ./nim-reset-project-structure 1234
To quickly find a job’s ID, look at the end of the URL of its Job Overview page in NIM. A job with ID 1234 on a NIM VM accessible at 192.168.1.199 will have the following Job Overview URL:
This script sets options for connecting to NIM via http and/or https. A self-signed certificate comes pre-installed on NIM VMs, so connecting to NIM via https works immediately.
Most browsers will warn you when connecting via HTTPS to a host with a self-signed certificate. Some browsers allow you to store an exception for specific sites, so the warning will only be displayed the first time. You can replace this self-signed certificate with your own verified certificate if necessary.
To open port 80 (allow unencrypted http access as well as encrypted https access–this is the default state):
sudo ./nim-ssl -open80
To close port 80 (disallow unencrypted http access):
sudo ./nim-ssl -close80
To redirect port 80 to port 443 (redirect http to https):
sudo ./nim-ssl -redirect80
The nim-auth script will allow users to switch authentication services from the NIM VM command line.
This script sets NIM’s authentication method which is one of 3 modes:
nim - uses NIM’s internal authentication (default)
ad - connects to an Active Directory server(s) for authentication
ldap - connects to a LDAP server(s), such as openLDAP, for authentication
To execute this script use the following syntax and pass the desired authentication method.
sudo ./nim-auth nim sudo ./nim-auth ldap sudo ./nim-auth ad
The nim-db-export script will create a file containing the contents of the current NIM database.
To export the NIM database:
sudo ./nim-db-export \"/example/export/path\"
For example, to export the database to the /home/nim/database-backups:
sudo ./nim-db-export \"/home/nim/database-backups\"
The nim-db-import script will import the NIM database exported from the nim-db-export script.
To import the NIM database:
sudo ./nim-db-import \"/example/import/path/to/file\"
For example, to import the database to the /home/nim/database-backups/nim_db_export.190301.sql:
sudo ./nim-db-import \"/home/nim/database-backups/nim_db_export.190301.sql\"