سؤال

I have a script and I want to create my log file with datetime and with unique name. It's my script:

.......
.......
rman target/  LOG='/u01/backup/logs/rman.log' <<EOF
.......
.......
.......
EOF

How can I do it? Thank you.

هل كانت مفيدة؟

المحلول

If I were doing this in the bash shell on Linux, I'd use the date command:

$ date '+%y%m%d-%H%M%S'
20191115-111213

$ LOG_PATH="/u01/backup/logs"
$ UNIQUE="NAME"

$ rman target / LOG="${LOG_PATH}/rman.${UNIQUE}.$(date '+%y%m%d-%H%M%S').log" <<EOF
. . . 
EOF

$ ls ${LOG_PATH}
rman.NAME.20191115-111314.log

Remember that you'll need to clean up all these log files, from time to time.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى dba.stackexchange
scroll top