Relative Content

Tag Archive for gocommand-line-interfacego-cobra

Sending a signal from running cobra command to another cobra command which is running GOLANG

I am trying to achieve something not sure whether it’s possible or not. Just out of curious asking this. I have a cobra command for ex. app reconcile. when i ran app reconcile i will be running a infinity for loop which will be doing some reconcile operation still system is up. I have another one cobra command which is like stopping one systemd service and do some operation and enable it but in the reconcile loop I am checking whether that particular systemd service is up or not if it’s not it will start it so my second command getting was unable to stop the service. Is any way I can send a signal to other commands for loop to pause it(maybe once received the signal sleep for a particular time). Is this possible ? I don’t want to use database or any state file for this in golang does it have some magic in it?