Using perl to fork a process and terminate it if over X second
Posted on 2014-04-16
Here is my problem, often that when I am using tnsping to test a TNS Alias, the command could take minutes to return if there is a network disruption.
Can I wrap the tnsping command a perl command using fork and alarm feature, so that if the child process is ubale to complete with X second, this perl command will return 1 otherwise return 0
let's say tns alias: SID_HOSTX
$ tnsping SID_HOSTX #could take minutes to return not ok