Solved

What is this line of code doing?

Posted on 2004-08-31
1
507 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
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…
This video discusses moving either the default database or any database to a new volume.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

707 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now