Sponsored Content
Operating Systems Linux Ubuntu How can I automatically start a daemon at boot time. Post 302269555 by s93366 on Thursday 18th of December 2008 03:32:52 AM
Old 12-18-2008
a basic unix daemon does the following:

fork
close all filedescriptors (stdout,stderr, etc)
chdir /
signal handeling (sighup, sigterm etc)
while
do stuff
sleep(xx)
done

(example in C: daemon.c)


Red Hat example on how to install startup scripts:

to start a deamon at system startup in redhat you need a init script.
it should be placed in /etc/init.d

example of init script :

Code:
# chkconfig: 3 99 1
# description: my daemon

case "$1" in
'start')
/usr/local/bin/mydaemon
;;

'stop')
pkill mydaemon
;;

'restart')
pkill -HUP mydaemon
;;

esac

the first line will tell chkconfig to start the daemon in run level 3 with priority 99 and kill it as priority 1 when server shutdowns.

to install the startup script use the following: chkconfig --add ./scriptabove
Now it will start when the server boots.

to start it right away use: service <name_of_initfile> start


Hope this helps somewhat!

Last edited by s93366; 12-18-2008 at 04:38 AM..
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Disable routed daemon at boot time????

I'm new to UNIX.... I'm running SCO UNIX and would like to disable routed daemon from being start at boot time. How should I do this????? Please help. (2 Replies)
Discussion started by: rrivas
2 Replies

2. UNIX for Advanced & Expert Users

start a process at boot up time

Hi, I have a program that check the IP address and automatic update it to the DNS server. I would like to run this program when the computer bootup after pppd get a connection. How do I add it to the init file. Does any one have any information of how to do it. I run a Linux Mandrake as a... (1 Reply)
Discussion started by: vtran4270
1 Replies

3. Solaris

Database can't start automatically on solaris

Hi, I have installed oracle 9i on solaris 10 sucessfully. I have configured listener & tnsname.ora file sucessfuly. Even i can start database manully by starting listener first and from sqlplus promt data base sucessfully. Now i want to start the database automatically after system reboots. I... (2 Replies)
Discussion started by: Sachin Vaidya
2 Replies

4. HP-UX

HP UX start process at boot time

When I get start program at boot I read which run level /sbin/rcx.d runlevel=0.....x only read directory which directory name has UpperCase 'S' is not enough someone says that I need to reference another file which file I need to reference 1)/etc/rc.config.d/all file which parameter... (4 Replies)
Discussion started by: alert0919
4 Replies

5. Shell Programming and Scripting

Start program in background (or start crontab ahead of time)

Hey! I'm working on a script that will add a user, create some configfiles, and add a crontab for the user. The crontab looks like the following: @reboot /home/user/program config.conf & I would like for this process to start at the end of my script under the corresponding username by... (0 Replies)
Discussion started by: noratx
0 Replies

6. AIX

How to start rstatd Daemon

guy's How to start rstatd Daemon on AIX 6.1 as I enable it from etc/inetd.conf then I refreshed it by this command refresh -s inetd but stil is not Active ! can some one advice in this ! (7 Replies)
Discussion started by: ITHelper
7 Replies

7. Shell Programming and Scripting

How do I Start JBoss automatically when boot my linux machine.

I have created a script file named 'start-jboss' ------------------------------------------------- #!/bin/sh # For starting Jboss JAVA_HOME=/home/argole/jdk/jdk1.6.0_10 export JAVA_HOME cd /home/argole/server/jboss-4.2.0.GA/bin echo "Starting JBOSS server" nohup ./run.sh -c... (25 Replies)
Discussion started by: shiraz
25 Replies

8. UNIX and Linux Applications

How do I Start postgre SQL automatically when boot my linux machine

Can any body give me the script to start postgre SQL 8.3.1 when boot linux? (2 Replies)
Discussion started by: shiraz
2 Replies

9. UNIX for Advanced & Expert Users

start some services automatically

Hello All i have a question related to some services,i want to start some services with server linux centos. i make "chkconfig httpd on" and "chkconfig asterisk on",but when i verify with chkconfig --list i found httpd 0: off 1: off 2: on 3: on 4: on 5: on 6:... (6 Replies)
Discussion started by: bernard12
6 Replies

10. Red Hat

Can't start NTOP service/daemon

I have installed version of ntop 4.0.3 by guide. But I can't start ntop daemon/service. I didn't find a service file for starting. During the installation there was no problem only want to RRDTool so I installed that. Now there is no necessary package required. I didn't find in /etc/init.d/... (9 Replies)
Discussion started by: getrue
9 Replies
intrbald(1M)															      intrbald(1M)

NAME
intrbald - daemon for balancing interrupts SYNOPSIS
interval | DESCRIPTION
Balancing interrupts is a process which distributes interrupts across the available CPUs in an optimal fashion. This action is performed by (see intctl(1M)). Performing frequent CPU migrations between system partitions may require you to perform periodic balancing of interrupts. This is espe- cially true with systems that use WLM (Workload Manager), iCAP (Instant Capacity), and vPars (Virtual Partitions) products. If the fre- quency of CPU migration is high, then balancing of interrupts should be performed more frequently. The daemon monitors the system for imbalance in interrupt distribution. If an imbalance is detected after the specified interval executes to balance the interrupt distribution. uses the parameters from the configuration file for balancing the interrupts. For more information about the command, see intctl(1M) and the configuration file. The daemon is started from the general purpose sequencer script (see rc(1M)), at run level 2 and is killed at run level 1. By default, the daemon is not enabled. The daemon configuration file must be edited and the parameter set to in order to enable running the daemon. After setting to for the first time, you can start the daemon manually by executing the script Otherwise, the daemon will automatically start the next time the system is restarted. Any actions performed by the daemon are logged in and details of interrupt migrations performed will be logged in the file Options recognizes the following options: Instructs the running daemon to reexamine the configuration file If the parameter has been updated, then the running daemon uses the new value. If the parameter is set to then the running daemon stops executing. The daemon checks if the system requires any balancing of interrupts after interval seconds; the valid range is 5 seconds to seconds (see limits(5)). This value can also be specified persistently in the configuration file by setting the parameter. The default value is 60 seconds. Setting this value too small can cause unnecessary interrupt migrations. Gracefully kills the running daemon. intrbald rc Configuration File is the configuration file. The following parameters can be persistently specified in this configuration file: Specifies if the daemon should be started automatically during the system bootup process by the script. The daemon will only be started automatically if this parameter is set to NOTE: This value is by default. Before using the daemon, needs to be changed to in the file. Then the daemon needs to be started, either manually by running or it will be started automatically at next boot via the script. The daemon checks if the system requires any interrupt balancing after this interval. The interval is specified in seconds; the valid range is 5 seconds to seconds (see lim- its(5)). The default is 60 seconds. Setting this value too small could cause unnecessary interrupt migrations. RETURN VALUE
Exit values are: Successful completion. An error condition occurred. WARNINGS
The command can be executed only by the superuser. This command should be used only by performance analysts for performance tuning pur- poses. If the interrupts are not redistributed properly, a possible decrease in overall system performance can occur. Some processors can become overloaded while other processors will not be optimally utilized. FILES
configuration file. See the section above. script. start symbolic link. kill symbolic link. daemon log file. SEE ALSO
intctl(1M), ioscan(1M), rc(1M), limits(5). intrbald(1M)
All times are GMT -4. The time now is 01:52 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy