in reply to How do I start a perl daemon at boot time

Hi, Is it me who post the questions. Thank you for your imput. I read the manual on chkconfig and I did not understand a thing. Is it me beeing stupid or linux is hard? I will try use this comand and came back to you.
  • Comment on Re: How do I start a perl daemon at boot time

Replies are listed 'Best First'.
Re^2: How do I start a perl daemon at boot time
by roboticus (Chancellor) on Feb 02, 2007 at 03:33 UTC
    magnolia:

    It's not you being stupid or linux being hard. It's just a different way of doing things. So it's more like "you're speaking Polish and the computer is speaking French".

    For what it's worth, there are graphical tools for linux that let you do that in a few clicks of a mouse too. But when you're in the unix/linux world, you eventually learn that the mouse might seem like a nice way of doing things, but it isn't as powerful as the keyboard. So most unix/linux people I know tend to do everything in a shell window. You get more control over the system and you learn how things work (and work together!).

    An example: In Windows if you want to delete the file foo.bar, you just drag it to the recycle bin or right-click it in an explorer window and select delete. Simple! In a linux machine you type "rm foo.bar". Easy, but not as simple as a point & click, is it?

    Ah, but suppose you need to delete all backup and object files in a directory with a q in their name. In linux "rm *q*.{bak,o}". Simple! On a Windows machine, you click--and drag. Click--and drag. Click--and drag. What a drag!

    One other thing. Everyone I know who uses linux/unix finds it "hard" when they start. There are *so* many things to learn. But if you keep reading your man pages and working in it, you'll all of a sudden have a mental "click" and it's not hard anymore. You'll then find that you're much more productive in a good command shell, and having to do everything with the mouse will annoy you because it's just too slow for lots of tasks. So much so, that you'll want to find a good unix-like environment for Windows so you can do things the same way on both machines.

    --roboticus

Re^2: How do I start a perl daemon at boot time
by Joost (Canon) on Feb 01, 2007 at 20:28 UTC
    All you need to do is add two lines of comments to your /etc/init.d/SCRIPTNAME script that tell chkconfig at which runlevels it should run.

    from this manpage:

    For example, random.init has these three lines: # chkconfig: 2345 20 80 # description: Saves and restores system entropy pool for \ # higher quality random number generation. This says that the random script should be started in levels 2 +, 3, 4, and 5, that its start priority should be 20, and that its stop + prior- ity should be 80. You should be able to figure out what the d +escrip- tion says; the \ causes the line to be continued. The extra sp +ace in front of the line is ignored.
    The runlevel determines at which runlevels the deamon should run. The system is always in one runlevel only. Usual runlevels are 3 for multi-user non-graphical (default mode for server machines), 5 for multi-user graphical mode (default mode for desktop machines) and 1 for single-user non-gui mode (for low-level system management and repair). what each runlevel is for can be changed, these are just usual configurations

    To see which run-level is the default for your system, take a look at /etc/inittab. There should be a line about that at the top somewhere. Mine looks like:

    # The default runlevel. id:3:initdefault:
    So my machine's default runlevel is 3 (though I also use 5)

    The start and end priorities determine the order in which deamons are started and stopped: higher start priority means it's started later than lower priority.

    After you've done that, run "chkconfig --add NAME_OF_SCRIPT_IN_INITRD" to add it to the list of deamons to start automatically.