Unix Directory Permission Checking Script
Looking for shell script command to check Unix directory permission? Here’s the series of command to verify writing permission before running the Oracle SQL Loader (sqlldr).
Every directory and file on the Unix system has an owner and also an associated group. It also has a set of permission flags which specify separate read, write and execute permissions for the ‘user’ (owner), ‘group’, and ‘other’ (everyone else with an account on the computer).
Developer who code any loading program using shell script should include the logic to check on the Unix directory permission.
This is to make sure the shell script has the permission to write into certain directory using Oracle SQL Loader (sqlldr).
Include the shell script command logic as below to check the directory permission in the file pre-processing stage.
#!/bin/bash #Check DATA directory to see if it exists or is not writable. if [ ! -w $CUSTOM_TOP/load/data/ ] then echo "Write permission is not granted to $CUSTOM_TOP/load/data" echo "Or directory does not exist" exit 1 else echo "$CUSTOM_TOP/load/data exist" fi #Check ARCH directory to see if it exists or is not writable. if [ ! -w $CUSTOM_TOP/load/arch/ ] then echo "Write permission is not granted to $CUSTOM_TOP/load/arch" echo "Or directory does not exist" exit 1 else echo "$CUSTOM_TOP/load/arch exist" fi #Check BAD directory to see if it exists or is not writable. if [ ! -w $CUSTOM_TOP/load/bad/ ] then echo "Write permission is not granted to $CUSTOM_TOP/load/bad" echo "Or directory does not exist" exit 1 else echo "$CUSTOM_TOP/load/bad exist" fi
Related Posts
- Security Scan For Weak Directory Permission
- Sqlplus EOF In Unix Shell Script
- Add/Register Shell Script In Oracle Applications
- Cannot Unlink: Permission Denied
- Retry SFTP Connection In Shell Script
PreviousNext» Shell Script Check File Extension Plus Format



