projects
/
tpope-extra.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Assorted away-tpope updates
[tpope-extra.git]
/
perl
/
mobile-phone-monitor
diff --git
a/perl/mobile-phone-monitor
b/perl/mobile-phone-monitor
index dbc549f08d54b6a06f8823e070ea76f9ea4c1811..5a46f1e2a954b2cad27540933daae393da8c9011 100755
(executable)
--- a/
perl/mobile-phone-monitor
+++ b/
perl/mobile-phone-monitor
@@
-123,6
+123,21
@@
sub output_status {
rename "/tmp/.phone-status.new", "/tmp/.phone-status" || die $!;
}
rename "/tmp/.phone-status.new", "/tmp/.phone-status" || die $!;
}
+sub daemonize {
+ chdir "/";
+ my $pid=fork();
+ if($pid) {
+ exit(0)
+ }
+ elsif(defined($pid))
+ {
+ close STDIN;
+ close STDOUT;
+ close STDERR;
+ }
+ else { exit(1); }
+}
+
sub death {
$gsm->disconnect() if($gsm);
unlink "/tmp/.phone-status.new", "/tmp/.phone-status";
sub death {
$gsm->disconnect() if($gsm);
unlink "/tmp/.phone-status.new", "/tmp/.phone-status";