Tuesday, October 8, 2024
HomeGolangDrawback about operating a command within the background - Getting Assist

Drawback about operating a command within the background – Getting Assist


Hey there,

I’m engaged on a CLI utility utilizing the Cobra framework to implement the customers’ price range. The customers will set the price range quantity for various classes and when the spending quantity crosses, the person will get the alert notification by way of electronic mail that the person has spent cash out of limitation and this would be the quick message.

However right here is one other performance: the person can even set the alert time to ship the alert notification at a specific time and date.

All of this stuff are working advantageous however here’s a drawback that I need to cope with.

When the person writes a command like app notify, the applying will begin operating like this

github.com/ibilalkayy/challenge$ app notify
E-mail despatched at Date: 6/2/2024, Time: 7:00 PM
E-mail despatched at Date: 6/3/2024, Time: 7:00 PM
E-mail despatched at Date: 6/4/2024, Time: 7:00 PM

Once I cease operating this utilizing Ctrl+C the applying won’t ship the emails as a result of the command isn’t operating.

Now I desire a function like docker by which the container runs even when the docker run command isn’t operating on the CLI or if the terminal is closed however the container is operating within the background.

I don’t know obtain this factor. I’d respect it for those who may give me an concept about it.

Thanks!

If it’s a CLI-Software you also needs to take into consideration pc restarts. What you most likely need is the applying operating as a service. Routinely beginning every time the pc begin (the person logs on)

Relying on Linux / Home windows there are numerous methods for a program to run as a service (Linux Daemon, Home windows Service) or simply run like a process on System Startup (Home windows autostart and process scheduler) – relying in your customers certainly one of these will most likely do what you need.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments