linux下监听文件listener.ora在哪

linux下监听文件listener.ora在哪,第1张

cd $ORACLE_HOME/network/admin 找到network/admin/listener.ora 如果没有那就是默认配置了 如果你的监听的默认的用$lsnrctl status查看 如果你的监听不是默认的用$lsnrctl status xxxx 查看 注xxx为监听名

#! /bin/bash

$FILE_LIST=$(find . -type f -cmin -5 -maxdepth 1)

for file in ${FILE_LIST} do

ln -f ${file} ~/tmp/${file}

done

##其中find命令是核心

##-type f表示只查找普通文件

##-cmin -5表示只查找5分钟之内创建的文件

##-maxdepth 1表示查找的目录深度,1表示只查找当前目录,如果不指定-maxdepth将递归查找

##ln -f ${file} ~/tmp/${file}是将查找到的文件硬链接到~/tmp目录

##你可以根据自己的需要再做相应的修改

JDK 7 的nio2 WatchService可以监听文件系统。

Oracle官方教程链接 http://docs.oracle.com/javase/tutorial/essential/io/notification.html

样例代码:

import static java.nio.file.StandardWatchEventKinds.*

Path path = Paths.get("/home")

WatchService watchService = FileSystems.getDefault().newWatchService()

WatchKey watchKey = path.register(watchService,ENTRY_CREATE,ENTRY_DELETE,ENTRY_MODIFY)

/*

private boolean notDone = true

while(notDone){

    try{

         WatchKey watchKey = watchService.poll(60,TimeUnit.SECONDS)

         List<WatchEvent.Kind<?>> events = watchKey.pollEvents()

         for(WatchEvent event : events){

            //WatchKey watchable returns the calling Path object of Path.register

             Path watchedPath = (Path) watchKey.watchable()

             //returns the event type

             StandardWatchEventKinds eventKind = event.kind()

             //returns the context of the event

             Path target = (Path)event.context()

         }

         if(!watchKey.reset()){

            ...handle situation no longer valid

         }

     }catch(InterruptedException e){

            Thread.currentThread().interrupt()

     }

}

*/


欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/yw/7648038.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-08
下一篇2023-04-08

发表评论

登录后才能评论

评论列表(0条)

    保存