I was working on implementing error handling in my bash scripts, and decided to use trap to send myself an email incase of any errors. But it seems that somethings has gone wrong, and I am continuously getting same emails for an old error repeatedly (even though I have stopped/killed all instances of the script).
Artifacts:
I am using a common script called: catch-errors.sh to catch errors:
catch-errors.sh
</code>
Now, I am using above script in another main script for error handling: main-script.sh
Can someone please help.. how to stop the emails I am continuously getting?
I have killed any instance of above script, but still getting emails.
I have observed one thing - all the emails are for an old error since the timestamp being printed is the same old one, so I am guessing that maybe the trap function itself is throwing some error which is causing it to invoke itself again and again.
Any help would be appreciated..
Last edited by cool.aquarian; 02-25-2015 at 08:57 PM..
To my understanding, the issue is behind the --- do something ---.
Though, havent worked with trap yet.
Not sure if you could 'add' a break to the trap, as in, break if trap gets raised?
(EDIT: just seeing now...) Confusing part is, you already got an exit 2 there....
Hello Experts,
I have created one user confirmation process that will ask for user input. I have created one func for it. The issue is if i call it as normal then it works fine but if i am calling it in another script(in while loop) . It is going in infinite loop and not asking for user input. ... (8 Replies)
I have a script script.shwhich is scheduled to run at 11 AM everyday.
# script.sh Code:
./scb_script.sh &
unfortunately scb_script.sh is running today in infinite loop as respective files are not available.
My question, when script.sh starts running tomorrow, will the old process be... (1 Reply)
Im unable to stop the below infinite loop (bash script). Can someone tell me why this isnt responding to signals eg: ctrl+c (SIGINT) or ctrl+z
c=0
test_loop() {
c=$(($c+1))
echo "count value is : $c "
sleep 1
test_loop
}
Im using: SunOS 5.10
PS: If run this as... (13 Replies)
Hi, I was debating if I should put this in the dummies or scripts section, I apologize in advance if I chose poorly.
Fairly new to Unix and BASH scripting but I thought I made it fairly well given my limited understanding. However, the output indicates that it's looping and I'm ending up with a... (5 Replies)
1. The problem statement, all variables and given/known data:
My problem is an infinite loop when i press any other key other then Y or y in the while loop. what i want it to do is return to the normal script outside of it if pressing N or n or keep asking the same question if its any other... (4 Replies)
Hi All,
I need to run an infinite loop.
requirement below:
function1 --> creates a file file1
function2 ---> need to call if the file creates
i am running these both function via a script --> script.sh
i need to run the function1 first and if the file file1 creates then need to run the... (3 Replies)
hi all,
this is how my scrip looks like
#!/bin/sh
bindir='/opt/apps/script/bin'
datadir='/opt/apps/script/data'
dir='/opt/apps/script'
while : ; do
ls -1rt /opt/apps/script/data/check.txt*|tail -1 > /dev/null 2>&1
if ;then
chmod +rwx $bindir/dummy2.sh
... (8 Replies)
Does anyone know what __read_nocancel does and why it would go into an infinite loop?
What I have gathered in my searches is that it pertains to server code. Yet, I'm not running this application in server mode.
NOTE: There are server functions in the shared object, but the specific code... (3 Replies)
Hi,
whenever I am giving a 'ls' command system is going into infinite loop displaying the current home directory.
There is no separate shell script/file with ls name anywhere in the system.
I am using Solaris 10.
Any help / guidance in solving this problem is highly appreciated.
... (3 Replies)