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?
I tried state file, like when i want to stop the loop i will create a file and in the loop each iteration it will check if file is there or not. if exist it will have a fake inner loop to prevent other code getting executed. But i don’t want to use a state file looking for other solution.
Ranjith is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.