The UNIX Forums
"Join the Network of UNIX System Users"


 
Subject: starting daemons at reboot.
Madness
Newbie
Rank: 1



UID 244
Digest Posts 0
Credits 0
Posts 35
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 7, 2007 10:52 AM  Profile | P.M. 
starting daemons at reboot.



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?


Top
guppyman
Newbie
Rank: 1



UID 168
Digest Posts 0
Credits 0
Posts 5
Reading Access 10
Registered Apr 25, 2007
Status Offline
Post at Jun 7, 2007 10:53 AM  Profile | P.M. 
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
Top
 

 

All times are GMT, the time now is Jul 31, 2010 03:27 AM

Powered by Discuz! 5.0.0  © 2001-2006 UNIX Forums
Processed in 0.009753 second(s), 8 queries

Clear Cookies - Contact Us - UNIX Help - Archiver - WAP