How to run console function from regular controller?

I have a background task that I can run from ssh. How can I call it from my controller in frontend?