From: Tim Pope Date: Wed, 1 Jun 2005 05:14:59 +0000 (+0000) Subject: If I have to commit one more time, I will have no choice but to sully my good logs... X-Git-Url: http://git.tpope.net/?p=tpope-extra.git;a=commitdiff_plain;h=0eb98c72012721eefe1c90875538d914ea70b741 If I have to commit one more time, I will have no choice but to sully my good logs with profanity --- diff --git a/perl/mobile-phone-monitor b/perl/mobile-phone-monitor index dbc549f..5a46f1e 100755 --- 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 $!; } +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";