Skip to content

Commit

Permalink
runUserScripts if exist
Browse files Browse the repository at this point in the history
  • Loading branch information
pavlobornia committed Aug 6, 2019
1 parent 6fc8ab7 commit a661716
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions assets/runUserScripts.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/bin/bash
set -e
source /assets/colorecho
source ~/.bashrc

### RUN USER DEFINED SCRIPTS AND PATCHES
SCRIPTS_ROOT="/opt/init";

# Check whether parameter has been passed on
if [ -z "$SCRIPTS_ROOT" ]; then
echo_yellow "$0: No SCRIPTS_ROOT passed on, no scripts will be run";
exit 1;
fi;

# Execute custom provided files (only if directory exists and has files in it)
if [ -d "$SCRIPTS_ROOT" ] && [ -n "$(ls -A $SCRIPTS_ROOT)" ]; then

echo "";
echo_green "Executing user defined scripts"

for f in $SCRIPTS_ROOT/*; do
case "$f" in
*.sh) echo_green "$0: running $f"; . "$f" ;;
*.sql) echo_green "$0: running $f"; echo "exit" | $ORACLE_HOME/bin/sqlplus -s "/ as sysdba" @"$f"; echo ;;
*) echo_yellow "$0: ignoring $f" ;;
esac
echo "";
done

echo_green "DONE: Executing user defined scripts"
echo "";

fi;

0 comments on commit a661716

Please sign in to comment.