Run and Report

If you're frequently starting long running jobs (like yocto builds) and want to be notified as soon as they've completed (instead of having to return an hour later to discover the compilation errored out two minutes into the build), the following little helper may be for you. Just drop the following function into your .bashrc:

rnr()
{
    eval $@
    MSG="rnr: $@ exited with status $?"
    notify-send "$MSG"
}

Now pass your build command to rnr to be informed when it finishes:

$ rnr bitbake core-image-minimal
...

If you're lucky you'll get

run-and-report notification popup

Notes:

  • use double quotes for chained commands, e.g. $ rnr "echo 1 && echo 2"
  • notify-send is part of the libnotify-bin package