File tree 3 files changed +30
-24
lines changed
operator/src/main/resources/scripts
3 files changed +30
-24
lines changed Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- # Copyright (c) 2017, 2021 , Oracle and/or its affiliates.
3
+ # Copyright (c) 2017, 2022 , Oracle and/or its affiliates.
4
4
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
5
5
6
6
# Kubernetes periodically calls this liveness probe script to determine whether
@@ -35,9 +35,9 @@ if [ ! "${DYNAMIC_CONFIG_OVERRIDE:-notset}" = notset ]; then
35
35
tgt_file=$tgt_dir /$tgt_file # add back in tgt dir path
36
36
[ -f " $tgt_file " ] && [ -z " $( diff $local_fname $tgt_file 2>&1 ) " ] && continue # nothing changed
37
37
trace " Copying file '$local_fname ' to '$tgt_file '."
38
- cp $local_fname $tgt_file # TBD ignore any error?
38
+ copyIfChanged $local_fname $tgt_file
39
39
if [ -O " $tgt_file " ]; then
40
- chmod 770 $tgt_file # TBD ignore any error?
40
+ chmod 770 $tgt_file
41
41
fi
42
42
done
43
43
for local_fname in ${tgt_dir} /* .xml ; do
Original file line number Diff line number Diff line change 1
1
#! /bin/bash
2
2
3
- # Copyright (c) 2017, 2021 , Oracle and/or its affiliates.
3
+ # Copyright (c) 2017, 2022 , Oracle and/or its affiliates.
4
4
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
5
5
6
6
#
29
29
exportInstallHomes
30
30
31
31
#
32
- # Define helper fn to copy a file only if src & tgt differ
33
- #
34
-
35
- function copyIfChanged() {
36
- [ ! -f " ${1?} " ] && trace SEVERE " File '$1 ' not found." && exit 1
37
- if [ ! -f " ${2?} " ] || [ ! -z " ` diff $1 $2 2>&1 ` " ]; then
38
- trace " Copying '$1 ' to '$2 '."
39
- cp $1 $2
40
- [ $? -ne 0 ] && trace SEVERE " failed cp $1 $2 " && exitOrLoop
41
- if [ -O " $2 " ]; then
42
- chmod 770 $2
43
- [ $? -ne 0 ] && trace SEVERE " failed chmod 770 $2 " && exitOrLoop
44
- fi
45
- else
46
- trace " Skipping copy of '$1 ' to '$2 ' -- these files already match."
47
- fi
48
- }
49
-
50
- #
51
32
# if the auxiliary image feature is active, verify the mount, and log mount information
52
33
#
53
34
checkAuxiliaryImage || exitOrLoop
Original file line number Diff line number Diff line change 1
- # Copyright (c) 2017, 2021 , Oracle and/or its affiliates.
1
+ # Copyright (c) 2017, 2022 , Oracle and/or its affiliates.
2
2
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl.
3
3
4
4
set -o pipefail
@@ -17,6 +17,31 @@ source ${SCRIPTPATH}/utils_base.sh
17
17
# [ $? -ne 0 ] && echo "[SEVERE] Missing file ${SCRIPTPATH}/utils.sh" && exit 1
18
18
#
19
19
20
+ #
21
+ # Define helper fn to copy a file only if src & tgt differ
22
+ #
23
+
24
+ function copyIfChanged() {
25
+ [ ! -f " ${1?} " ] && trace SEVERE " File '$1 ' not found." && exit 1
26
+ if [ ! -f " ${2?} " ] || [ ! -z " ` diff $1 $2 2>&1 ` " ]; then
27
+ trace " Copying '$1 ' to '$2 '."
28
+ # Copy the source file to a temporary file in the same directory as the target and then
29
+ # move the temporary file to the target. This is done because the target file may be read by another
30
+ # process during the copy operation, such as can happen for situational configuration files stored in a
31
+ # domain home on a persistent volume.
32
+ tmp_file=$( mktemp -p $( dirname $2 ) )
33
+ cp $1 $tmp_file
34
+ mv $tmp_file $2
35
+ [ $? -ne 0 ] && trace SEVERE " failed cp $1 $2 " && exitOrLoop
36
+ if [ -O " $2 " ]; then
37
+ chmod 770 $2
38
+ [ $? -ne 0 ] && trace SEVERE " failed chmod 770 $2 " && exitOrLoop
39
+ fi
40
+ else
41
+ trace " Skipping copy of '$1 ' to '$2 ' -- these files already match."
42
+ fi
43
+ }
44
+
20
45
# exportInstallHomes
21
46
# purpose: export MW_HOME, WL_HOME, ORACLE_HOME
22
47
# with defaults as needed
You can’t perform that action at this time.
0 commit comments