The Oracle FS CLI provides three methods for integrating commands in scripts.
Example |
! /usr/bin/env bash # example script using fscli credentials # command is automatically wrapped with a login and logout # verify command line arguments if [ $# -ne 2 ]; then echo "Usage: ./$(basename $0) <ofs-user-account> <ofs-name-or-ip>" exit 1 fi # prompt for password read -s -p "Password: " password # issue command and display result command="./fscli system -list -status -u $1 -oraclefs $2" command="echo $password | $command" eval $command |
Features |
The command is automatically wrapped with login and logout commands. |
Advantages |
|
Disadvantages |
None |
Example |
#! /usr/bin/env bash # example script using fscli local file # session key automatically managed by fscli # verify command line arguments if [ $# -ne 2 ]; then echo "Usage: ./$(basename $0) <ofs-user-account> <ofs-name-or-ip>" exit 1 fi # prompt for password read -s -p "Password: " password # login command="./fscli login -u $1 -oraclefs $2" command="echo $password | $command" eval $command # issue command and display result command="./fscli system -list -status" eval $command # logout command="./fscli logout" eval $command |
Features |
The Oracle FS CLI manages the session key using a temporary file. |
Advantages |
Next to the Credentials Integration method, the easiest method to implement |
Disadvantages |
|
Example |
#! /usr/bin/env bash # example script using fscli session key # session key managed by user # verify command line arguments if [ $# -ne 2 ]; then echo "Usage: ./$(basename $0) <ofs-user-account> <ofs-name-or-ip>" exit 1 fi # prompt for password read -s -p "Password: " password # login and return session key command="./fscli login -u $1 -oraclefs $2 -returnKey" command="echo $password | $command" eval $command # prompt for session key read -s -p "Sessionkey: " sessionKey # issue command and display result command="./fscli system -list -status -sessionKey" command="echo $sessionKey | $command" eval $command # prompt for session key read -s -p "Sessionkey: " sessionKey # logout command="./fscli logout -sessionKey" command="echo $sessionKey | $command" eval $command |
Features |
The user manages the session key. |
Advantages |
Can be used to log in and manage one or more Oracle FS System sessions concurrently |
Disadvantages |
|