mirror of
https://github.com/Installomator/Installomator.git
synced 2026-02-18 12:32:32 +00:00
cleanupAndExit with trap #575
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kenchan0130 on GitHub.
While running the Installomator script, the process may be interrupted for some reason.
For example, the case where the "Self Service" of Jamf policy is canceled by an end-user while it is running.
In that case, the dmg mount and so on may continue to remain, so it would be good if
cleanupAndExitcan be executed even if the process is stopped.The method doesn't have to use
trap, but in a shell script, this kind of function has been originally achieved bytrap.@samerfarida commented on GitHub:
Hello @acodega,
We can actually use
trapwith some functions to print out the reason for termination.The following snippet of code can be added to the top of the main Installomator script,
Here is a sample of the logs when script interrupted by Control+C
Here is a list of possible signals to be trapped except there are two signals which cannot be intercepted and handled:
SIGKILLandSIGSTOP.Please let me know what are your thoughts on this?
Thank you
Sammy
Global Endpoint Security Engineer
@acodega commented on GitHub:
Closing no response.
@acodega commented on GitHub:
Do either of you want to open a PR to add this support? You would want to do it against the
devbranch, which we use for new non label related features.@acodega commented on GitHub:
I'm tagging this as help wanted as it could use input form others as to what the implications would be.