Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have a Fedora 5 system installed on my computer and I want this daemon to be created at boot time. I read different posts on internet on how to do that and I understand that you have to put a script in etc/init.d which I did :#!/usr/bin/perl use POSIX qw(setsid); chdir '/' or die "cannot change to /:$!"; open STDIN,'/dev/null' or die "cannot read stdin:$!"; #open STDOUT ,'>>/dev/null' or die "cannot write to stdout:$!"; open STDERR ,'>>/dev/null' or die "cannot write to stderr:$!"; defined(my $pid=fork) or die "cannot fork process:$!"; exit if $pid; setsid; umask 0; while(1) { #system("perl Test.pl") or die "Can't exec: $!\n"; ($second, $minute, $hour, $dayOfMonth, $month, $yearOffset, $dayOf +Week, $dayOfYear, $daylightSavings) = localtime(); if ($hour < 19) { $waitSeconds = (19-$hour) * 3600 - 60 * $minute - $second; } $date = `date`; print "The date is $date \n"; print "The number of seconds $waitSeconds\n"; sleep($waitSeconds); &loadData; }
But still when I restart the server and then check the process list wit ps axj my daemon is not there. I will greatly appreciate your help.#!/bin/sh # Source function library. . /etc/rc.d/init.d/functions # See how we were called. case "$1" in start) # Start daemons. echo -n "Start load data daemon" perl home/magda/WorkArea/MyPerlScripts/DaemonScripts/TestDaemo +n.pl ;; stop) # Stop daemons. ;; restart) $0 stop $0 start ;; esac
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How do I start a perl daemon at boot time
by Fletch (Bishop) on Feb 01, 2007 at 16:13 UTC | |
|
Re: How do I start a perl daemon at boot time
by Joost (Canon) on Feb 01, 2007 at 16:14 UTC | |
by magnolia (Initiate) on Feb 01, 2007 at 16:33 UTC | |
by jhourcle (Prior) on Feb 01, 2007 at 16:41 UTC | |
|
Re: How do I start a perl daemon at boot time
by sgt (Deacon) on Feb 01, 2007 at 17:12 UTC | |
by shigetsu (Hermit) on Feb 01, 2007 at 21:40 UTC | |
by magnolia (Initiate) on Feb 05, 2007 at 17:13 UTC | |
|
Re: How do I start a perl daemon at boot time
by magnolia (Initiate) on Feb 01, 2007 at 16:42 UTC | |
by roboticus (Chancellor) on Feb 02, 2007 at 03:33 UTC | |
by Joost (Canon) on Feb 01, 2007 at 20:28 UTC |