summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xemergencyc.pl6
-rwxr-xr-xemergencyd.pl18
2 files changed, 16 insertions, 8 deletions
diff --git a/emergencyc.pl b/emergencyc.pl
index 296297f..86c9da7 100755
--- a/emergencyc.pl
+++ b/emergencyc.pl
@@ -39,7 +39,8 @@ my $key;
if ( defined($opts{K}) ) {
$key = $opts{K};
} elsif ( defined($opts{k}) ) {
- open my $key_file, "<", $opts{k} or die "Cannot open key file $opts{k}: $!";
+ open my $key_file, "<", $opts{k}
+ or die "Cannot open key file $opts{k}: $!";
$key = <$key_file>;
chomp $key;
close $key_file;
@@ -59,7 +60,8 @@ bind $socket, sockaddr_in6(0, in6addr_any);
sub curtime {
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time);
- return sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ",$year+1900,$mon+1,$mday,$hour,$min,$sec);
+ return sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ",
+ $year+1900,$mon+1,$mday,$hour,$min,$sec);
}
my $command = $ARGV[0] // "PING";
diff --git a/emergencyd.pl b/emergencyd.pl
index 6019029..a0512fd 100755
--- a/emergencyd.pl
+++ b/emergencyd.pl
@@ -95,9 +95,11 @@ if ( defined($opts{p}) ) {
$port = DEFAULT_PORT;
}
-socket my $socket, PF_INET6, SOCK_DGRAM, $proto or die "Can't create socket: $!";
+socket my $socket, PF_INET6, SOCK_DGRAM, $proto
+ or die "Can't create socket: $!";
if ( defined(IPV6_V6ONLY) ) {
- setsockopt $socket, IPPROTO_IPV6, IPV6_V6ONLY, 0 or die "Can't set IPV6_V6ONLY option to 0: $!";
+ setsockopt $socket, IPPROTO_IPV6, IPV6_V6ONLY, 0
+ or die "Can't set IPV6_V6ONLY option to 0: $!";
}
bind $socket, sockaddr_in6($port, in6addr_any) or die "Can't bind socket: $!";
@@ -114,8 +116,10 @@ if ( $opts{f} ) {
sub curtime {
my $fiddle = shift // 0;
- my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime(time+$fiddle);
- return sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ",$year+1900,$mon+1,$mday,$hour,$min,$sec);
+ my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)
+ = gmtime(time+$fiddle);
+ return sprintf("%04d-%02d-%02dT%02d:%02d:%02dZ",
+ $year+1900,$mon+1,$mday,$hour,$min,$sec);
}
my $mintime = "0";
@@ -171,8 +175,10 @@ while (1) {
my $s = $1;
my $resp = "DONE\n";
eval {
- open my $sysrq_trigger, ">", "/proc/sysrq-trigger" or die "Couldn't open /proc/sysrq-trigger for writing: $!";
- print $sysrq_trigger $s or die "Couldn't write to /proc/sysrq-trigger: $!";
+ open my $sysrq_trigger, ">", "/proc/sysrq-trigger"
+ or die "Couldn't open /proc/sysrq-trigger for writing: $!";
+ print $sysrq_trigger $s
+ or die "Couldn't write to /proc/sysrq-trigger: $!";
close $sysrq_trigger;
};
if ( $@ ) {