I had this feeling years ago. Wife left me, didn't see my kids, yadda yadda yadda. Considered pulling the plug, but I had kids. I didn't want to put them through that trauma. Spoke to a friend that helped me get the help I needed. I was still suicidal when an old friend of mine decided to end his own life. I saw the pain he left his family, and decided that was the turning point for me. I had more to live for than to escape dying. How'd it turn out? Wife and I got back together and stayed together another 30 years before divorcing. My kids had me around to live them going up. My grandkids adore me. In all, it's worth it.
Seek help. Talk to a clergyman that may be able to straighten out your priorities. Local mental health centers are also a start. Many base services on your income.
Talk to your friends, get a support group around you.