Job-faq.com

linux alert when job finished

by Eladio Herzog Published 7 months ago Updated 7 months ago
image

Basic principle - use /usr/bin/time to measure the time it takes for command to complete, and if it is over 15 seconds, send notification. function measure () { if [ $ (/usr/bin/time -f "%e" $@ 2>&1 >/dev/null) -gt 15 ]; then notify-send "Hi, $@ is done !" fi }

Full Answer

Is there a way to automatically send notifications when long running commands?

It is cross-platform and can automatically send notifications when long running commands finish. If you have Python's pip (most Linux distros and MacOS have it), here's how to install it and enable automatic notifications:

How do I send an email alert in Linux?

You can also have an email alert sent to you at a certain time. If you have an engagement in the evening, you can program it into Linux so you don’t forget! First, let’s take a quick look at how you can send an email to yourself. The command for it is “ mailx ” or “ mail “.

What are the benefits of email alerts in Linux?

Having an alert sent to you through email can be very useful. For example, if you have a large build being done in the background, it makes no sense to wait around for the process to finish. In such cases, you can have Linux send you a message once the build is done.

How do I get an email alert when the server wakes up?

You can either keep typing commands in the shell or you can have an email alert delivered to you when the server wakes up. You can use this command, for example: If you look closely, the code above is an infinite loop. When your system pings the server (servername), the loop gets broken and a mail will be sent to you.

image

Can you put any shell command as condition?

You can put virtually any shell command as the condition (so long as it’s sensible and doesn’t overload your system):

Can you send an alert to Linux?

Having an alert sent to you through email can be very useful. For example, if you have a large build being done in the background, it makes no sense to wait around for the process to finish. In such cases, you can have Linux send you a message once the build is done. It saves you a lot of time.

Can you keep typing commands in the shell?

You can either keep typing commands in the shell or you can have an email alert delivered to you when the server wakes up. You can use this command, for example: If you look closely, the code above is an infinite loop. When your system pings the server (servername), the loop gets broken and a mail will be sent to you.

background job finished notification

In my last job someone gave me the command to put in my .profile that let me know when a job I had running in the background finished. It was a word about 5 char long. I can't remember it!

Notification after job is done

Hello everyone, I have a server in another country, so I would like to run a notification sound, that I can hear in my computer after a job is finished, I found so many commands, like: COMMAND HERE spd-say 'Done' But I cannot hear any sound, the command line does NOT return any error,... (6 Replies)

Background Job

Hello Everyody, Having a doubt. sort file1 & when we sent a job to the background it returns Job Number PID again if we want to ... (1 Reply)

Cron Job notification email

Hi, I'm fairly new to Aix and am looking for some help on the following. I have setup a cron job under root and want it to send the email once it's run to an external email address. I can get it to send the output in an email to me by using mail on the end of the crontab entry. But I would... (1 Reply)

Notification from Background jobs

Reposting, as it got lost during the database backup. : ( Via a shell script a spawn 3 background jobs namely a, b & c. These will take different times to complete. I want to print a different message on completion of each. How can i find out when each one has completed independently. ... (19 Replies)

Cannot submit a background job

Hi all, I am currently facing a problem when i am submitting a script to run in the background to collect statistics round the clock on an AIX box. I don't have root authority nor can I set it in cron. So when i submit the job, it runs fine, but won't let me signoff. It prompts me that... (2 Replies)

background job

on gnome i open a terminal and run wget http://soommmething & in the background. because wget shows me downloading progress percentage and download speed continuously, I exit the gnome-terminal after a while i want to see the download percentage but dont know how. my ps -u myname shows that... (3 Replies)

image
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9