Live data from Hacker News

Show HN: Alert yourself after a long-running task in terminal

gist.github.com

31–40 of 51 posts

Re: Show HN: Alert yourself after a long-running task in terminal

#32
Ah, I have something like this just for `make`[0], which I've found very useful.

Running it on DEBUG so it covers all commands is an interesting idea. I'm not sure I'd want alerts on things like exiting vim/less though. I don't suppose there's some nifty heuristic for whether programs accept user input?

[0] [link redacted]

Re: Show HN: Alert yourself after a long-running task in terminal

#33

OP is on Mac, which has the open command, which will open its arguments the same way they'd be opened by the Finder. My solution is usually as follows: $ long-running-command; open song.mp3

Sounds like the open command is similar to xdg-open.

Re: Show HN: Alert yourself after a long-running task in terminal

#34
post #29

I use `noti` for this: `some_task && noti` `noti some_task` both work. https://github.com/variadico/noti

You can also use noti to watch a process id, in case you start a process but forget to append noti

wow, I didn't know this, thanks for the info. Sometimes it happens that I run something and after 30 minutes think "Hmm, would have been great to add noti"

Re: Show HN: Alert yourself after a long-running task in terminal

#36

Personally I have a flask app deployed on heroku that posts a message to a Discord webhook just by visiting an url. So in my case when I use ssh to run long tasks I have at the end "curl https:// .herokuapp.com/?Finished" and as soon as that commands is executed I receive a message either at my phone or computer (through a channel in a personal discord server). Probably is a bit of a 'hacky' way, and using different…

I have a similar thing with telegram bot: https://pastebin.com/Ei3hjcKa Written in Go so it's static and portable.

Re: Show HN: Alert yourself after a long-running task in terminal

#37

Personally I have a flask app deployed on heroku that posts a message to a Discord webhook just by visiting an url. So in my case when I use ssh to run long tasks I have at the end "curl https:// .herokuapp.com/?Finished" and as soon as that commands is executed I receive a message either at my phone or computer (through a channel in a personal discord server). Probably is a bit of a 'hacky' way, and using different…

This seems a little over complicated since curl itself could just post to discord.

Re: Show HN: Alert yourself after a long-running task in terminal

#38

OP is on Mac, which has the open command, which will open its arguments the same way they'd be opened by the Finder. My solution is usually as follows: $ long-running-command; open song.mp3

You could also use `say`

`say $?` would be pretty nice.

Re: Show HN: Alert yourself after a long-running task in terminal

#40
There is a native feature for this however gnome-terminal won't ship it largely due to disagreement how to integrate it with shells. However Fedora includes patches for it and I use it every day and it is amazing. The best thing about the native integration is that it notifies for every command completion where the terminal isn't focused. This means that when I am watching the terminal I don't get distracting notifications at the top of my screen and closing vim or less even if it has been open for a while doesn't trigger it either. The time based approach is just not as good as you may miss short commands (especially unexpectedly short, so you switch away because you think it will take a while then are confused when you don't see the notification you expected) and get bothered unnecessarily when you are looking at the terminal.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=795774

VTE Patch: https://src.fedoraproject.org/rpms/vte291/raw/623150318ddb9a...

gnome-terminal Patch: https://src.fedoraproject.org/rpms/gnome-terminal/raw/bb5f88...

Post reply on HN