blog:2012:08:24:disable_bash_alarm_clock_message
Disable Bash "Alarm clock" message
In a “cronjob” , this “Alarm clock” message is somewhat difficult to hide…
Same effect in bash shell:
$ perl -e 'alarm 5;sleep(10);' >/dev/null 2>&1 Alarm clock
$ ( perl -e 'alarm 5;sleep(10);' ) >/dev/null 2>&1 Alarm clock
My best answer:
( trap 'exit 1' SIGALRM ; perl -e 'alarm 5;sleep(10);' ) >/dev/null
~~READMORE~~
So now, I can write a script like this:
#!/usr/bin/perl -w use warnings; use strict; use IO::Handle; autoflush STDOUT 1; { alarm(3); for( my $i=1; $i<5; $i++ ) { print "Yo! $i\n"; sleep(1); } print "End never reach."; }
… and put it in my cronjob like that:
* * * * * ( trap 'exit 1' SIGALRM ; ~/testalarm.pl ) >/dev/null 2>&1
Now: The “Alarm clock” still exists , but it now sent in /dev/null
.
blog/2012/08/24/disable_bash_alarm_clock_message.txt · Dernière modification : 2012/08/24 14:36 de thierry