Win XP(192.168.0.100)上装了VM6 WorkStation6.0其内安装了CentOS5.1(192.168.0.101);通过控制面板-->放火墙-->高级--》开启了本地连接2的FTP服务器和Telnet服务器;XP可正常访问CentOS5.1的ORACLE 10G服务器和WEB应用;CentOS5.1上装有Oracle 10.2.0.1服务端GZGA用户ksxt密码:1234,服务和监听已启动
********************************************************************
想在CentOS5.1下通过一个shell脚本定时导出ORACLE 10G的某用户DMP文件然后把导出的DMP文件传输到Win XP的共享目录F:\HardDiskGame 下
shell脚本backup.sh源码如下:
#!/bin/bash
source ~/.bash_profile
export ORACLE_HOME=/u01/app/oracle/product/10.2.0.1
export ORACLE_SID=gzga
#export NLS_LANG=ZHS16GBK
rq=`date +%y%m%d`
$ORACLE_HOME/bin/exp ksxt/1234 owner=ksxt file=/backup/exp_${rq}.dmp log=/backup/exp_${rq}.log
rq=`date +%y%m%d_%H`
ftp -i -v -n 192.168.0.100 < <END
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
终端里运行导出SHELL脚本backup.sh
[oracle@localhost /]$ ./backup.sh
Begin backup databases.....CentOS5.1_gzga
导出前时间: 2008年 09月 26日 星期五 13:10:46 CST
Export: Release 10.2.0.1.0 - Production on Fri Sep 26 13:10:46 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user KSXT
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user KSXT
About to export KSXT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export KSXT's tables via Conventional Path ...
. . exporting table EXAMINE 307 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EXAMINECONDITION 1053 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table EXAMINEE 6 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EXAMINEGROUP 109 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EXAMINEPAPER 5 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table FUNCTION 222 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table GROUPINFO 12 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table HZPYDZB 6763 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table KEY 936 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table PARAMETER 9 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table ROLE 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table ROLEDATA 1 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table ROLEFUNCTION 253 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table TMP1 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TMP2 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TMP3 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TMP4 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TMP5 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table USERLOGIN 3935 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table USERPROFILE 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table USERROLE 7 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.. . exporting table USERUNSUCCESSLOG 107 rows exported
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully with warnings.
Export mission over!
导出后时间: 2008年 09月 26日 星期五 13:11:21 CST
Connected to 192.168.0.100.
421 Service not available, remote server has closed connection
[oracle@localhost /]$
************************************************************************************************
请问上述红字错误是什么原因?如何具体设置才能导出DMP文件的过程无警告和ftp winxp都正常?要实现我预期的功能该如何实现上述脚本?或请提供更高效简便的方
案!
********************************************************************
想在CentOS5.1下通过一个shell脚本定时导出ORACLE 10G的某用户DMP文件然后把导出的DMP文件传输到Win XP的共享目录F:\HardDiskGame 下
shell脚本backup.sh源码如下:
#!/bin/bash
source ~/.bash_profile
export ORACLE_HOME=/u01/app/oracle/product/10.2.0.1
export ORACLE_SID=gzga
#export NLS_LANG=ZHS16GBK
rq=`date +%y%m%d`
$ORACLE_HOME/bin/exp ksxt/1234 owner=ksxt file=/backup/exp_${rq}.dmp log=/backup/exp_${rq}.log
rq=`date +%y%m%d_%H`
ftp -i -v -n 192.168.0.100 < <END
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++=
终端里运行导出SHELL脚本backup.sh
[oracle@localhost /]$ ./backup.sh
Begin backup databases.....CentOS5.1_gzga
导出前时间: 2008年 09月 26日 星期五 13:10:46 CST
Export: Release 10.2.0.1.0 - Production on Fri Sep 26 13:10:46 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Export done in US7ASCII character set and AL16UTF16 NCHAR character set
server uses ZHS16GBK character set (possible charset conversion)
About to export specified users ...
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user KSXT
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user KSXT
About to export KSXT's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export KSXT's tables via Conventional Path ...
. . exporting table EXAMINE 307 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EXAMINECONDITION 1053 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table EXAMINEE 6 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EXAMINEGROUP 109 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table EXAMINEPAPER 5 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table FUNCTION 222 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table GROUPINFO 12 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table HZPYDZB 6763 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table KEY 936 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table PARAMETER 9 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table ROLE 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table ROLEDATA 1 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table ROLEFUNCTION 253 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table TMP1 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TMP2 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TMP3 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TMP4 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table TMP5 0 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table USERLOGIN 3935 rows exported
EXP-00091: Exporting questionable statistics.
. . exporting table USERPROFILE 4 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.
. . exporting table USERROLE 7 rows exported
EXP-00091: Exporting questionable statistics.
EXP-00091: Exporting questionable statistics.. . exporting table USERUNSUCCESSLOG 107 rows exported
EXP-00091: Exporting questionable statistics.
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully with warnings.
Export mission over!
导出后时间: 2008年 09月 26日 星期五 13:11:21 CST
Connected to 192.168.0.100.
421 Service not available, remote server has closed connection
[oracle@localhost /]$
************************************************************************************************
请问上述红字错误是什么原因?如何具体设置才能导出DMP文件的过程无警告和ftp winxp都正常?要实现我预期的功能该如何实现上述脚本?或请提供更高效简便的方
案!
1.创建auto_ftp.sh文件,内容如下:
user userName password
binary
cd /u01/app/ncerp_backup
get autoBackup_ncerp.2007.01.05.dmp.gz
bye2.创建bat文件,添加如下内容:
ftp -i -n -v -s:auto_ftp.sh 192.168.0.100
server uses ZHS16GBK character set (possible charset conversion)"看一下: http://topic.csdn.net/t/20030710/20/2014176.html
[root:/]#ping 192.168.0.101
PING 192.168.0.101 (192.168.0.101) 56(84) bytes of data.
64 bytes from 192.168.0.101: icmp_seq=1 ttl=64 time=4.33 ms64 bytes from 192.168.0.101: icmp_seq=2 ttl=64 time=0.306 ms
--- 192.168.0.101 ping statistics ---
11 packets transmitted, 11 received, 0% packet loss, time 10006ms
rtt min/avg/max/mdev = 0.051/0.532/4.335/1.208 ms [root:/]#ftp 192.168.0.100
Connected to 192.168.0.100.
421 Service not available, remote server has closed connection
ftp>
请教WIN XP下具体该如何设置,才能在CentOS下执行SHELL脚本,在脚本中主动地利用FTP把dmp和log文件传送到WIN XP的共享目录F:\HardDiskGame 下?
2、shell脚本中,最后
ftp -n 192.168.0.100 <<EOF
user USERNAME PASSWORD
bina
send 源文件 目的文件
bye
EOF
#!/bin/bash
source ~/.bash_profile
echo "Begin ftping dmp files....."
rq=`date +%y%m%d`
echo "导出前时间: " `date`
cp /backup/*.dmp /root/
ls -l backup
rq=`date +%y%m%d_%H`
echo "导出后时间: " `date`
#ftp -i -v -n 192.168.0.100 <<END
ftp -n 192.168.0.100 <<EOF
user vaio 123950
bina
send /backup/*.dmp HardDiskGame
echo "Sending finished"
bye
EOF
*******************************************************
User:vaio Pwd:123950为WIN XP操作系统登录用户及密码;HardDiskGame 为WIN XP操作系统的共享目录位于F盘下!想通过shell脚本把导出ORACLE 10G的DMP文件Win XP的共享目录F:\HardDiskGame 下*******************************************************************
[root:/]#./test.sh
/root/.bash_profile: line 18: end: command not found
Begin ftping dmp files.....
导出前时间: 2008年 09月 27日 星期六 02:26:52 CST
总计 3324
-rw-r--r-- 1 oracle oinstall 671744 09-24 20:15 exp_080924.dmp
-rw-r--r-- 1 oracle oinstall 671744 09-24 19:17 exp080924.dmp
-rw-r--r-- 1 oracle oinstall 4584 09-24 20:15 exp_080924.log
-rw-r--r-- 1 oracle oinstall 671744 09-25 10:16 exp_080925.dmp
-rw-r--r-- 1 oracle oinstall 4584 09-25 10:16 exp_080925.log
-rw-r--r-- 1 oracle oinstall 671744 09-26 22:23 exp_080926.dmp
-rw-r--r-- 1 oracle oinstall 2866 09-26 22:23 exp_080926.log
-rw-r--r-- 1 oracle oinstall 671744 09-27 02:13 exp_080927.dmp
-rw-r--r-- 1 oracle oinstall 2866 09-27 02:13 exp_080927.log
导出后时间: 2008年 09月 27日 星期六 02:26:52 CST
Not connected.
Not connected.
Not connected.
?Invalid command
*****************************************************************************
请教上述错误原因?具体如何设置修改?
Connected to 192.168.0.100.
421 Service not available, remote server has closed connection
ftp>
想通过shell脚本test.sh把/backup目录里的导出ORACLE 10G的DMP文件传输到同一局域网内Win XP的共享目录F:\HardDiskGame 下,具体该怎么配置CentOS5.1和Win XP下的FTP服务器,请指教!
我想拷备源文件 /backup/*.dmp和*.log 到目标文件夹WIN XP的共享目录F:\HardDiskGame 下在脚本里怎么描述?
在CentOS 下:
************************************************************
[root:/]#ftp 192.168.0.102
Connected to 192.168.0.102.
220 Microsoft FTP Service
500 'AUTH GSSAPI': command not understood
500 'AUTH KERBEROS_V4': command not understood
KERBEROS_V4 rejected as an authentication type Name (192.168.0.102:root): ALFRED01\Guest
331 Password required for ALFRED01\Guest.
Password:
530 User ALFRED01\Guest cannot log in.
Login failed.
ftp>
Win XP下:
***************************************************
C:\>ftp 192.168.0.102
Connected to 192.168.0.102.
220 Microsoft FTP Service
User (192.168.0.102:(none)): Guest
331 Password required for Guest.
Password:
530 User Guest cannot log in. Login failed.
ftp>
*****************************************************
C:\>ftp 192.168.0.102
Connected to 192.168.0.102.
220 Microsoft FTP Service
User (192.168.0.102:(none)): ALFRED01\Guest
331 Password required for ALFRED01\Guest.
Password:
530 User ALFRED01\Guest cannot log in. Login failed.
ftp>
*********************************************************
[root:/]#ftp 192.168.0.102
Connected to 192.168.0.102.
220 Microsoft FTP Service
500 'AUTH GSSAPI': command not understood
500 'AUTH KERBEROS_V4': command not understood
KERBEROS_V4 rejected as an authentication type
Name (192.168.0.102:root): anonymous
331 Anonymous access allowed, send identity (e-mail name) as password.
Password:
530 User Anonymous cannot log in.
Login failed.
ftp>
什么原因导致上述错误出现?请教怎么设置FTP站点,能让我以用户Guest,密码:1234从CentOS的终端命令行下FTP连接到WIN XP并发送文件?
Connected to 192.168.0.100.
220 Microsoft FTP Service
500 'AUTH GSSAPI': command not understood
500 'AUTH KERBEROS_V4': command not understood
KERBEROS_V4 rejected as an authentication type
Name (192.168.0.100:root): vaio
331 Password required for vaio.
Password:
230 User vaio logged in.
Remote system type is Windows_NT.
ftp> pwd
257 "/" is current directory.
ftp> send backup.sh backup.sh2
local: backup.sh remote: backup.sh2
227 Entering Passive Mode (192,168,0,100,19,138).
550 backup.sh2: Access is denied.
ftp>
WINDOWS XP(192.168.0.100) IIS服务设置默认FTP站点 属性:允许匿名连接,允许IIS控制密码!
CentOS5.1的/目录下确实有 backup.sh这个文件,请教什么原因导致上述错误?
错误提示信息如下:
Oct 2 20:52:18 localhost crond[4239]: (CRON) STARTUP (V5.0)
Oct 2 20:52:18 localhost crond[4239]: (*system*) BAD FILE MODE (/etc/cron.d/backupGZGA.sh)
Oct 2 20:56:18 localhost crontab[4398]: (oracle) LIST (oracle)
Oct 2 20:59:12 localhost crontab[4608]: (oracle) LIST (oracle)
Oct 2 21:01:01 localhost crond[4667]: (root) CMD (run-parts /etc/cron.hourly)
Oct 2 21:05:12 localhost crontab[4835]: (oracle) LIST (oracle)
Oct 2 21:06:06 localhost crontab[4865]: (oracle) LIST (oracle)
Oct 2 21:06:36 localhost crond[4945]: (CRON) STARTUP (V5.0)
Oct 2 21:06:36 localhost crond[4945]: (*system*) BAD FILE MODE (/etc/cron.d/backupGZGA.sh)
Oct 2 21:06:40 localhost crond[4998]: (CRON) STARTUP (V5.0)
Oct 2 21:06:40 localhost crond[4998]: (*system*) BAD FILE MODE (/etc/cron.d/backupGZGA.sh)
Oct 2 21:10:55 localhost crond[5259]: (CRON) STARTUP (V5.0)
Oct 2 21:10:55 localhost crond[5259]: (*system*) BAD FILE MODE (/etc/cron.d/backupGZGA.sh)
Oct 2 21:10:58 localhost crond[5298]: (CRON) STARTUP (V5.0)
Oct 2 21:10:58 localhost crond[5298]: (*system*) BAD FILE MODE (/etc/cron.d/backupGZGA.sh)
Oct 2 21:15:53 localhost crond[5603]: (CRON) STARTUP (V5.0)
Oct 2 21:15:53 localhost crond[5603]: (*system*) BAD FILE MODE (/etc/cron.d/backupGZGA.sh)
Oct 2 21:18:37 localhost crond[5760]: (CRON) STARTUP (V5.0)
Oct 2 21:18:37 localhost crond[5760]: (*system*) BAD FILE MODE (/etc/cron.d/backupGZGA.sh)
Oct 2 21:19:20 localhost crond[5851]: (CRON) STARTUP (V5.0)
Oct 2 21:19:20 localhost crond[5851]: (*system*) BAD FILE MODE (/etc/cron.d/backupGZGA.sh) [oracle@localhost /]$ crontab -l
*/1**** /backupGZGA.sh
***********************************************************************************************
etc/cron.d中的backupGZGA.sh的源文件内容如下:
###!/bin/bash
source ~/.bash_profile
echo "Begin backup databases.....CentOS5.1_gzga"
export ORACLE_HOME=/u01/app/oracle/product/10.2.0.1
export ORACLE_SID=gzga
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
rq=`date +%y%m%d`
echo "Starting time:"`date`
$ORACLE_HOME/bin/exp ksxt/1234 owner=ksxt file=/backup/exp_${rq}.dmp log=/backup/exp_${rq}.log
cp /backup/*.dmp /root/
ls -l backup
lftp -c "open 192.168.0.100;user vaio 123950;mirror -R /backup;put backupGZGA.sh"
rq=`date +%y%m%d_%H`
echo "Export mission over!"
echo "End time:"`date`
***************************************************************************************
var/spool/cron/oracle的内容为:*/1**** /backupGZGA.sh
******************************************************************************************
想在CentOS和ORACLE 10G启动后以ORACLE用户让每分钟CentOS5.1自动成功运行一次backupGZGA.sh
请教上述错误原因?具体如何解决?
是我定制crontab任务语句和编码有问题吗?
[oracle@localhost /]$ crontab -l
*/1**** /backupGZGA.sh
需要改成*/1**** /bin/bash /backupGZGA.sh吗?还是我的脚本在在WINXP下编辑过的原因,如果是具体怎么修改?
#!/bin/bash
echo "Begin backup databases.....CentOS5.1_gzga"
export ORACLE_HOME=/u01/app/oracle/product/10.2.0.1
export ORACLE_SID=gzga
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
rq=`date +%y%m%d`
echo "Starting time:"`date`
$ORACLE_HOME/bin/exp ksxt/1234 owner=ksxt file=/backup/exp_${rq}.dmp log=/backup/exp_${rq}.log
lftp -c "open 192.168.0.100;user vaio 123950;mirror -R /backup;put /backupGZGA.sh"
rq=`date +%y%m%d_%H`
echo "Export mission over!"
echo "End time:"`date`
*****************************************************************
在上述脚本中怎样实现 1."脚本被CRON自动调用执行完成后把整个执行过程中终端中产生的日志及提示信息输入到\gzgaCronLog.log文件中去,向[email protected]发个邮件标题为GZGA Mission Finished.并发送附件gzgaCronLog.log.
2."脚本被CRON自动调用执行完成后向终端中发送提示信息:"XXXX年XX月XX日XX时XX分XX秒 GZGA Mission Finished Pls check ur mail",当前用户没有打开终端就自动开启一个终端发送粗体提示信息:"XXXX年XX月XX日XX时XX分XX秒 GZGA Mission Finished" ,提示信息最好在终端的正中央!
非常感谢!
#!/bin/bash
echo "Begin backup databases.....CentOS5.1_gzga"
export ORACLE_HOME=/u01/app/oracle/product/10.2.0.1
export ORACLE_SID=gzga
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
rq=`date +%y%m%d`
echo "Starting time:"`date`
$ORACLE_HOME/bin/exp ksxt/1234 owner=ksxt file=/backup/exp_${rq}.dmp log=/backup/exp_${rq}.log
lftp -c "open 192.168.0.100;user vaio 123950;mirror -R /backup;put /backupGZGA.sh"
rq=`date +%y%m%d_%H`
echo "Export mission over!"
echo "End time:"`date`
*****************************************************************
如何实现:1.向[email protected]发个邮件标题为GZGA Mission Finished.并发送附件gzgaCronLog.log. 最好不用sendmail
2."脚本被CRON自动调用执行完成后向终端中发送提示信息:"XXXX年XX月XX日XX时XX分XX秒 GZGA Mission Finished Pls check ur mail",当前用户没有打开终端就自动开启一个终端发送粗体提示信息:"XXXX年XX月XX日XX时XX分XX秒 GZGA Mission Finished" ,提示信息最好在终端的正中央!
在xp下制定任务计划,定期执行脚本,去服务器上取相关的文件。
这样,数据库端只负责导出,估计导出完成后,在xp把相关的文件拿过来。如建立ftp.bat文件:
ftp -n -s:"ftpget.ftp"ftpget.ftp内容:
open 10.0.0.14
user oracle
myoracle
lcd d:\test
binary
prompt
mget /export/home/test/*.dmp
mget /export/home/test/*.log
bye
00-59/1 * * * * /backupGZGA.sh 1>>/tmp/gzgaCronLog.log 2>>/tmp/gzgaCronLog.log;cat /tmp/gzgaCronLog.log|mutt -s "GZGA backup finished!" -a /tmp/gzgaCronLog.log [email protected] 已实现每隔一分钟向[email protected]发标题为"GZGA backup finished!"的邮件并附件功能!怎样修改上述语句才能实现给[email protected]发送标题为"XXXX年XX月XX日XX时XX分XX秒GZGA backup finished!",附件为/tmp/gzgaCronLog.log中最后一百行的内容!XXXX年XX月XX日XX时XX分XX秒为oracle用户的crontab语句mutt执行时CentOS的当前时间。
2:脚本被CRON自动调用执行完成后向oracle终端中发送提示信息:"XXXX年XX月XX日XX时XX分XX秒 GZGA Mission Finished Pls check ur mail",当前用户没有打开终端就自动开启一个终端发送粗体提示信息:"XXXX年XX月XX日XX时XX分XX秒 GZGA Mission Finished" ,提示信息最好在终端的正中央!
实现在不行拆分成两个crontab语句也可以!
00-59/1 * * * * /backupGZGA.sh 1>>/tmp/gzgaCronLog.log 2>>/tmp/gzgaCronLog.log;curdate=`date +%y%m%d`;cat /tmp/gzgaCronLog.log|mutt -s GZGABackupFinished${curdate} -a /tmp/gzgaCronLog.log
/var/spool/mail/oracle:
From [email protected] Sat Oct 11 15:49:02 2008
Return-Path: <[email protected]>
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
by localhost.localdomain (8.13.8/8.13.8) with ESMTP id m9B7n1Eb018900
for <[email protected]>; Sat, 11 Oct 2008 15:49:01 +0800
Received: (from oracle@localhost)
by localhost.localdomain (8.13.8/8.13.8/Submit) id m9B7n1L2018899;
Sat, 11 Oct 2008 15:49:01 +0800
Date: Sat, 11 Oct 2008 15:49:01 +0800
Message-Id: <[email protected]>
From: [email protected] (Cron Daemon)
To: [email protected]
Subject: Cron <oracle@localhost> /backupGZGA.sh 1>>/tmp/gzgaCronLog.log 2>>/tmp/gzgaCronLog.log;curdate=`date +
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/oracle>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=oracle>
X-Cron-Env: <USER=oracle> /bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 1: syntax error: unexpected end of file
还是不行啊,错误信息如上,请教如何解决?
00-59/1 * * * * /backupGZGA.sh 1>>/tmp/gzgaCronLog.log 2>>/tmp/gzgaCronLog.log;/mailme.sh
/mailme.sh源码如下:
curdate=`date +%y%m%d_%H%M%S`;
tail -n 100 /tmp/gzgaCronLog.log > /tmp/gzgaCronLog.log.1;
cat /tmp/gzgaCronLog.log.1 |mutt -s GZGABackupFinised${curdate} -a /tmp/gzgaCronLog.log.1 [email protected];wall "${curdate}GZGA Backup Mission Finised Pls check u guys' mail!!"
************************************************************************************
上述语句已实现了:给[email protected]发送标题为"XXXX年XX月XX日XX时XX分XX秒GZGA backup finished!", 附件为/tmp/gzgaCronLog.log中最后一百行的内容!XXXX年XX月XX日XX时XX分XX秒为oracle用户的crontab语句mutt执行时CentOS的当前时间。
2:脚本被CRON自动调用执行完成后向当前所有已打开终端中发送提示信息:"XXXX年XX月XX日XX时XX分XX秒 GZGA Mission Finished Pls check ur mail",
现在的问题是:
感觉mutt有时不能正常按设定的时间来发送邮件,有时能.而且怎么设置能[color=#FF0000]让mutt支持中文?CentOS5.1的服务端在没有终端开启的情况下,wall "${curdate}GZGA Backup Mission Finised Pls check u guys' mail!!" 语句不能实现自动开启一个终端并在其中持续显示粗体"${curdate}GZGA Backup Mission Finised Pls check u guys' mail!!" [/color]
怎样实现上述功能请教具体步骤?
00-59/1 * * * * /testG.sh 根目录下testG.sh 源码:
export DISPLAY=:0;
pid=`ps -e | grep -E 'gnome-terminal' | awk '{print $1}'`
echo "$pid";
if [ "$pid" != "" ] ; then
gnome-terminal & fi
**************************************************************************************
上述crontab语句和shell脚本总是每隔一分钟就通过gnome-terminal弹出一个可交互式终端(由gnome-terminal命令开启并可接受wall广播信息),怎样通过修改上述代码实现:服务端没有终端打开时开启一个可交互式终端,当已有一个可交互式终端存在时就不再重复开启新的可交互式终端并保证其不自动关闭.
谢谢!
ORA-01033: ORACLE initialization or shutdown in progress
EXP-00030: Unexpected End-Of-File encountered while reading input
EXP-00000: Export terminated unsuccessfully脚本内容如下:
#!/bin/bash
echo "Begin backup databases.....CentOS5.1_gzga"
export ORACLE_HOME=/u01/app/oracle/product/10.2.0.1
export ORACLE_SID=gzga
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
rq=`date +%y%m%d`
echo "瀵煎嚭鍓嶆椂闂?is: " `date`
$ORACLE_HOME/bin/exp ksxt/1234 owner=ksxt file=/backup/exp_${rq}.dmp log=/backup/exp_${rq}.log
cp /backup/*.dmp /root/
ls -l /backup
ftp都省去了
for example:
从linux远程mount windows上的iso文件,并以光驱方式访问它
mount -t cifs //10.10.10.7/iso /mnt/win -o username=workgroup/adm
inistrator,password=321
,CentOS5.1下EXP命令在用户的终端命令行里可以执行,但在ORACLE用户下的crontab语句的SHELL脚本里去调用却出错: EXP-00056: ORACLE error 1033 encountered
ORA-01033: ORACLE initialization or shutdown in progress
EXP-00030: Unexpected End-Of-File encountered while reading input
EXP-00000: Export terminated unsuccessfully 脚本内容如下:
#!/bin/bash
echo "Begin backup databases.....CentOS5.1_gzga"
export ORACLE_HOME=/u01/app/oracle/product/10.2.0.1
export ORACLE_SID=gzga
export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK
rq=`date +%y%m%d`
echo "当前时间is: " `date`
$ORACLE_HOME/bin/exp ksxt/1234 owner=ksxt file=/backup/exp_${rq}.dmp log=/backup/exp_${rq}.log
cp /backup/*.dmp /root/
ls -l /backup
请教什么原因?如何解决?