Get Notified when your command in Terminal has finished
Currently i'm working a lot on serverless projects and deploying a new service that has multiple lambda's or event a step function can be time consuming. In this case it was quite often for me to "forget" about the running deploy in the Terminal and get distracted by something else. Checking from time to time the progress is also not fun, so i started to think on how can i get notified about my script finish. After some investigation i found 2 solutions :
iTerm Users
If you have iTerm ( if not, then i would recommend you to start using it)
Here's what you can do :
- Open iTerm
- Click on
iTerm
->Install Shell Integration
- After everything is done, before or while running your long running script (hello
brew update
orsls deploy
) press ⌥⌘ + A combination (option
+command
+A
). - Now you can put your terminal in background and check something else. When your script will finish, you will get a notification from iTerm
Terminal Users
Now, if you, for some reason, don't like iTerm and using something else (like Intellij products terminal), then you can install noti - small script that will also notify your on command execution result.
Here's what you need to do :
- brew install noti
- Run
noti brew update
- Put your terminal away and noti will let you know when your command is done.
Both approaches requiers some additional actions to do in order to get notifications - in case of iTerm you will have to press ⌥⌘ + A
everytime you want to "watch" command progress, and with noti
you will have to put noti
in front of your command.
Personally i think i will stick with iTerm feature for now, as pressing key combination is not hard and i don't have to modify my cli commands in order to get notified.
Big thanks to Paschalis for his answer in this Stackoverflow post