Visit Our UNIX and Linux User Community


Starting daemons at reboot.


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Starting daemons at reboot.
# 1  
Old 03-30-2007
Starting daemons at reboot.

I rebooted my server (solaris 5.8) and I had to manually start the cron and mailx daemons. How do I get these to automatically start at reboot?

Thanks in advance.
# 2  
Old 03-31-2007
In the directory "/etc/init.d" the following 2 files should be presend:

- cron
- sendmail

which look something like this:

Code:
# cat cron
#!/sbin/sh
#
# Copyright (c) 1997-1998 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident  "@(#)cron       1.13    98/04/19 SMI"

case "$1" in
'start')
        if [ -p /etc/cron.d/FIFO ]; then
                if /usr/bin/pgrep -x -u 0 -P 1 cron >/dev/null 2>&1; then
                        echo "$0: cron is already running"
                        exit 0
                fi
        fi

        if [ -x /usr/sbin/cron ]; then
                /usr/bin/rm -f /etc/cron.d/FIFO
                /usr/sbin/cron &
        fi
        ;;

'stop')
        /usr/bin/pkill -x -u 0 -P 1 cron
        ;;

*)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;
esac
exit 0

Code:
# cat sendmail
#!/sbin/sh
#
# Copyright (c) 1992, 1995, 1997 - 2000 by Sun Microsystems, Inc.
# All rights reserved.
#
#ident  "@(#)sendmail   1.16    00/09/06 SMI"

ERRMSG1='WARNING: /var/mail is NFS-mounted without setting actimeo=0,'
ERRMSG2='this can cause mailbox locking and access problems.'

case "$1" in
'start')
        if [ -f /usr/lib/sendmail -a -f /etc/mail/sendmail.cf ]; then
                if [ ! -d /var/spool/mqueue ]; then
                        /usr/bin/mkdir -m 0750 /var/spool/mqueue
                        /usr/bin/chown root:bin /var/spool/mqueue
                fi
                MODE="-bd"
                if [ -f /etc/default/sendmail ]; then
                        . /etc/default/sendmail
                fi
                #
                # * MODE should be "-bd" or null (MODE= or MODE="") or
                #   left alone.  Anything else and you're on your own.
                # * QUEUEINTERVAL should be set to some legal value;
                #   a sanity check is done below.
                # * OPTIONS is a catch-all; set with care.
                #
                if [ -z "$QUEUEINTERVAL" ]; then
                        QUEUEINTERVAL="15m"
                fi
                case $QUEUEINTERVAL in
                        *s | *m | *h | *d | *w) ;;
                        *)  QUEUEINTERVAL="15m" ;;
                esac
                if [ $QUEUEINTERVAL -le 0 ]; then
                        QUEUEINTERVAL="15m"
                fi
                /usr/lib/sendmail $MODE -q$QUEUEINTERVAL $OPTIONS &
                #
                # ETRN_HOSTS should be of the form
                # "s1:c1.1,c1.2        s2:c2.1 s3:c3.1,c3.2,c3.3"
                # i.e., white-space separated groups of server:client where
                # client can be one or more comma-separated names; N.B. that
                # the :client part is optional; see etrn(1M) for details.
                # server is the name of the server to prod; a mail queue run
                # is requested for each client name.  This is comparable to
                # running "/usr/lib/sendmail -qRclient" on the host server.
                #
                # See RFC 1985 for more information.
                #
                for i in $ETRN_HOSTS; do
                        SERVER=`echo $i | /usr/bin/sed -e 's/:.*$//'`
                        CLIENTS=`echo $i | /usr/bin/sed -n -e 's/,/ /g' \
                            -e '/:/s/^.*://p'`
                        /usr/sbin/etrn $SERVER $CLIENTS >/dev/null 2>&1 &
                done
        fi

        if /usr/bin/nawk 'BEGIN{s = 1}
            $2 == "/var/mail" && $3 == "nfs" && $4 !~ /actimeo=0/ &&
            $4 !~ /noac/{s = 0} END{exit s}' /etc/mnttab; then

                /usr/bin/logger -p mail.crit "$ERRMSG1"
                /usr/bin/logger -p mail.crit "$ERRMSG2"
        fi
        ;;

'stop')
        /usr/bin/pkill -x -u 0 sendmail
        ;;

*)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;
esac
exit 0

The following files should be present in "/etc/rc2.d"

- S75cron
- S88sendmail

if not present use the following commands:

Code:
# cd /etc/rc2.d
# ln /etc/init.d/cron S75cron
# ln /etc/init.d/sendmail S88sendmail

The following files should be present in the directories "/etc/rc0.d", "/etc/rc1.d" and "/etc/rcS.d"

- K40cron
- K36sendmail

If not present use the following command:

Code:
# cd /etc/rc0.d
# ln /etc/init.d/cron K40cron
# ln /etc/init.d/sendmail K36sendmail
# cd /etc/rc1.d
# ln /etc/init.d/cron K40cron
# ln /etc/init.d/sendmail K36sendmail
# cd /etc/rcS.d
# ln /etc/init.d/cron K40cron
# ln /etc/init.d/sendmail K36sendmail

# 3  
Old 04-03-2007
These are there. Still didn't startup..... Smilie

Last edited by reborg; 04-03-2007 at 04:28 PM.. Reason: remove pointless quoting.
 

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Linux

Application services not starting with server reboot

Hi All, My application uses three different sub-services to make complete application up and running to normal. The entry of all the three services are present in /etc/init.d directory with proper softlink created to application home path where it actually exists. In one rare case one of the... (3 Replies)
Discussion started by: hk_kamozalwar
3 Replies

2. AIX

sendmail/ntp/qdaemon not starting automaticlly after reboot ?!

Hi all, I have a small problem, after a reboot the following services do not start automaticly, like they are supposed to do even though they are commented in in /etc/rc.tcpip sendmail xntpd qdaemon snmpd snmpmibd aixmibd hostmibd why ?!?! anybody ? :confused: (3 Replies)
Discussion started by: art
3 Replies

3. HP-UX

status of daemons

Hi there all, Hey, is there a way to get the status of all daemons running on a HPUX? in an easy way? Like the same way how to vieuw the status of packages in cmviewcl. Thanks! (1 Reply)
Discussion started by: draco
1 Replies

4. Shell Programming and Scripting

daemons definition

hi there, can somebody give me a definition for daemons, or example what are they !! and what the use for? i've done some research and all what i found is /etc/... or /usr/bin/... and i haven't quietly got the concept. any ideas !! Thanks. (5 Replies)
Discussion started by: new2Linux
5 Replies

5. Solaris

starting Oracle on Reboot

Hi All, I have to maunally startup oracle and the associated listeners whenever the Sun Solaris server is rebooted. Is there any way by which, everytime the server boots up, The Oracle startups itself. Do we need to change the init.ora file or the init.d file? Please let me know which files... (1 Reply)
Discussion started by: rahulrathod
1 Replies

6. Linux

A doubt on Daemons

Hi there! I'm a bit curious on something about Daemons.... Supose you have two processes say A and B, where B is a daemon. A is totally independent from B. Is there a way for A to find out B's return code? Is there a way for A to find out when B ends? Thanks! (4 Replies)
Discussion started by: marioh
4 Replies

7. UNIX for Dummies Questions & Answers

Daemons

MYSQL-daemon don't started automatically by system-start. And same trouble with httpd too. I have SuSE 8.0. What can I do ? Thanks.... (6 Replies)
Discussion started by: Pennywize
6 Replies

8. Cybersecurity

root owner of daemons?

Hi all, what happens if i have a service running as root? if it is exploited what would happen? can a hacker actually becomes a hacker and screw up my whole box? thanks (1 Reply)
Discussion started by: xNYx
1 Replies

9. IP Networking

DNS daemons

Does anyone know the command to start the DNS Daemon. I looked in the /etc/init.d/inetsvc file and it tells me what the text should look like. When I go to open the corresponding files they are encoded and I can't read them. So is there a command that will start the DNS daemon? If... (8 Replies)
Discussion started by: Deuce
8 Replies

Featured Tech Videos