Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Crontab does not run

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

[oracle@tdsogg tmp]$ crontab -l

*/5 * * * * sh /tmp/delete.sh

*/5 * * * * /tmp/delete.sh

5 * * * * sh /tmp/delete.sh

5 * * * * /tmp/delete.sh

05 * * * * sh /tmp/delete.sh

05 * * * * /tmp/delete.sh

5 * * * * /tmp/delete.sh

5 * * * * sh /tmp/delete.sh

[oracle@tdsogg tmp]$ ls /tmp/delete.sh

/tmp/delete.sh

[oracle@tdsogg tmp]$ cat /tmp/delete.sh

#!/ bin/bash

DELETE_SCRIPT=/tmp/delete_script.sql

GET_DELETE_SQL=/tmp/get_delete_sql.sql

export DELETE_SCRIPT

export GET_DELETE_SQL

rm -rf "$DELETE_SCRIPT"

export ORACLE_SID=tdsogg

sqlplus " / as sysdba" @$GET_DELETE_SQL

chmod 775 $DELETE_SCRIPT

RMAN_LOG_FILE=/tmp/delete_log_`date +%Y%m%d_%H%M%S`.out

rman target / nocatalog msglog $RMAN_LOG_FILE @$DELETE_SCRIPT

Check the logs and nothing.

Manual sh delete.sh works

It's probably caused by environmental variables.

cat .bash_profile

will

PATH=$PATH:$HOME/bin

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1

export PATH=$PATH:$ORACLE_HOME/bin

Add it to delete.sh code, and it works fine.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report