Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- # Usage : ./script.perl <ifname> <dB thresold>
- use strict;
- use warnings;
- my $interface=$ARGV[0];
- my $threshold=$ARGV[1];
- my $delay=1;
- my $currentSignal = `nmcli -g SIGNAL d w list ifname $interface`;
- while(1){
- if ($currentSignal < $threshold){
- my $response=system("zenity --question --ellipsize --text=\"Wifi is under $threshold : $currentSignal\" --ok-label \"Sleep $delay seconds\" --cancel-label \"Turn off\";") >> 8;
- if ($response == 1){
- exit(0);
- }
- sleep($delay)
- }
- }
Add Comment
Please, Sign In to add comment