Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

What is this line of code doing?

Posted on 2004-08-31
1
515 Views
Last Modified: 2008-03-06
Can anyone please explain me what this line of code is doing:

1) daemon /usr/sbin/sendmail $([ "x$DAEMON" = xyes ] && echo -bd) $([ -n "$QUEUE" ] && echo -q$QUEUE) $SENDMAIL_OPTARG

2) daemon --check sm-client /usr/sbin/sendmail -L sm-msp-queue -Ac -q $SMQUEUE $SENDMAIL_OPTARG

These lines of code I have taken from sendmail script of Fedora Core, they seem to be too complex for me. Please explain as details as possible ;).

Thx a lot,
0
Comment
Question by:jetli
1 Comment
 
LVL 40

Accepted Solution

by:
jlevie earned 500 total points
ID: 11946355
The short answer is that they startup the MTA & MSP instance of sendmail. In both cases the actual launch of the sendmail binary is done by the daemon function from /etc/rc.d/init.d/functions. Its a "smart" function that tries to start the utility safely.

In the first line daemon will execute /usr/sbin/sendmail and build the argument list from the the variables:

If DAEMON=yes in /etc/sysconfig/sendmail -bd will be in the argument list from $([ "x$DAEMON" = xyes ] && echo -bd).

If QUEUE=?? in /etc/sysconfig/sendmail the value (??) will be used for the queue interval (e.g., -q1h) from $([ -n "$QUEUE" ] && echo -q$QUEUE)

And finally if there are any optional arguments (SENDMAIL_OPTARG) defined in /etc/sysconfig/network they'll be included.

The defaults of a RedHat/Fedora system would result in the following command line for starting Sendmail:

/usr/sbin/sendmail -bd -q 1h

In the second line the MSP instance is started in a similar manner. SMQUEUE will be set to the value of QUEUE (from /etc/sysconfig/sendmail) if it isn't otherwise defined. So the command looks like:

/usr/sbin/sendmail -L sm-msp-queue -Ac -q 1h
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question