I am beginning to believe that there is a problem in this line in the file
exec >> /dev/null 2>&1
I think that this is causing the problem exec >> /dev/null 2>&1
In C++ the "<<" or ">>" stands for a bit shift either right or left. Normally it would be followed by a number referring to the number to be shifted by. In assembly language you have something called "ROR" and "ROL" to shift bits. What I don't understand is why you would need to have ">>" in this line. To me it seems that the proper line would be this. exec > /dev/null 2>&1
Can any one confirm my thought(s) here 
In bash the > would indicate a write to a file of the given name, overwriting any previous content in that file. The >> would indicate that the write should be in the form of an addendum to the file in question. Being a write to /dev/null, I'd go with the >.
You are correct. However, there some subtle differences in the way ">" and ">>" act on the target
file.
Generally, you use ">" to over-write a file (or device in this case). ">" can also have the side effect
of changing file permissions. ">>" appends to the file in place, not touching file permissions.
When writing to a device (/dev/null) it is good form to use ">>".
For completeness, "2>&1" is a redirection of all information written to stderr to the stdout file descriptor.
If you just used "2>1", stderr will be redirected to a file called "1".
This should be right. It has been a while. Back in the day, I worked a AT&T Bell Labs, so got to
know Unix and its source code rather well...
We used to say "Unix is God's operating system and Emacs is his editor. Vi is a close second".

Take Care and Be Well,
AussieBear.