9 ms·
Ask HN: Reminders for long-running shell jobs?
You start a command in a shell and it takes more than a few minutes to finish, so you go work on something else and come back to it later. Any good advice for sending yourself a notice when it finishes?
In my case these jobs are usually run via SSH, so programs that rely on a GUI aren't useful.
- deleted 9y ago[deleted]
- jerrylives 9y agojust add something like `&& echo "Subject: task completed" | sendmail -your@email.com` if you are running it via ssh you can do 'ssh zerocool@htp.org bash -s' < local_script.sh` and then do whatever you want to do afterwards running things locally like make or tests i like to put `&& say done` at the end so i don't lose track of it.
- Davidbrcz 9y agoHave a look at liquid prompt https://github.com/nojhan/liquidprompt https://github.com/nojhan/liquidprompt
- richardknop 9y agoI would probably wrap the shell command in a file and at the end of the file either fire off an email to yourself, or send a text message, or call a notification API - whichever works best for you.
- weitzj 9y agoI put the job in a separate tmux window. When something/a character changes in the window, its color changes and I know I can look what happened.
- 12s12m 9y agoThis is an interesting problem :) For my local commands I have a small script called `b` which runs a command and shows a notification when it is done using notify-send.
- meta_AU 9y agoI use zsh, it has a variable called REPORTTIME that will print a report after long running commands. I have a custom report that includes the bell special character. This way any long running process will bell when it is done and also show the runtime and cpu time of the process.
- pigpigs 9y agoI personally curl a slack webhook that sends me a message. If the task is already running, ctrl + z and run bg. Then i run `wait <pid> && slack 'job done' `
- simon_acca 9y agoI use this little CLI utility that I wrote to send messages on Telegram via a Bot. https://github.com/simonacca/TellTg https://github.com/simonacca/TellTg All you have to do is `$ my_long_running_job; telltg "Done"` and you get a notification on all your devices. Very handy also for remote jobs. The best use case so far has been piping the udev log into it when my laptop is locked in a public place and I'm away. I get a notification on my phone when someone open/closes the lid, unplugs the charger, sticks a USB drive in and so on.
- pigpigs 9y agoCool! May I ask how do you hook it up with opening / closing lid, sticking usb drive etc?
- simon_acca 9y agoI simply do `udevadm monitor | telltg & i3lock`. It's ugly to look at, but the idea is that you should never receive any logs, if you do, don't look at them but rather get your laptop in sight quickly because something is happening to it (I use it in the public library or such settings).
- MichaelBurge 9y agoSometimes I add a "; mail" at the end of long-running commands.
- atsaloli 9y agoI use "; mail" too but if I forgot and need a notification after I've already launched the job "strace -f -p PID; mail" will email you once the job completes. You have to know the PID of the job.
- tedmiston 9y agoIf you happen to be on OS X, you can fire a notification into Notification Center from the terminal. osascript -e 'display notification "that thing is done" with title "my awesome title"' iTerm2 has a similar feature called Triggers [1]. [1]: https://www.iterm2.com/documentation-triggers.html https://www.iterm2.com/documentation-triggers.html
- ahoka 9y agoThe most unixy way is simply using the terminal 'bell': sleep 10 ; echo -e \\a Don't forget to set your terminal to notify you on bell. For example putty can flash the task bar icon.
- ezekg 9y agoIf it's important, I've used https://cronitor.io/ https://cronitor.io/ in the past to make sure that it finished successfully (single monitor is free). If it's unimportant, I'd probably just use a Slack webhook like pigpigs mentioned or a growl notification.