Results 1 to 5 of 5

Thread: Trying to clear up a definition.

  1. #1

    Trying to clear up a definition.

    I'm currently reading a book on Linux Security. SAMS teach yourself " Linux Security Basics".
    I have a terminology question about two words:
    The chapter lists several scripts in the init.d directory, that are possible candidates to be disabled for security reasons.
    I'll pick two of them for comparision.
    Atalk Starts services for AppleTalk networks.
    lpd Starts the print daemon, useful for accepting print jobs from remote sources for local printing.

    So my question is : what is the difference between a service and a daemon. I looked up the definition of daemon and it states the it is a program that runs in the background. It will do things at a certain time (if programmed) or will do something if a action is taken. Hitting a print icon I quess would be involking a daemon to do something.
    Are these words interchanged in computer manuals? Or is there a difference?

  2. #2

    Re:Trying to clear up a definition.

    Just an additional thought.
    My guess is that a service is provided, but it's static in nature.
    On the otherhand, a daemon, is dynamic, in that it can detect a users actions and start a process.
    I'm guessing here. Anyone have a solid answer.

  3. #3
    Advisor Outlaw's Avatar
    Join Date
    May 2001
    Location
    Clifton Park, NY
    Posts
    630

    Re:Trying to clear up a definition.

    This describes them as being generally the same thing. When I hear the term "service", I usually think windows. But, generally, you can replace daemon with service in the lpd statement and it still holds true.

  4. #4

    Re:Trying to clear up a definition.

    [quote author=Radar link=board=5;threadid=10109;start=0#msg91576 date=1104441009]
    This describes them as being generally the same thing. When I hear the term "service", I usually think windows. But, generally, you can replace daemon with service in the lpd statement and it still holds true.
    [/quote]

    Exactly. Service is more acceptable in non-tech areas.

  5. #5

    Re:Trying to clear up a definition.

    Also, a daemon tends to be one binary. A service (I think) can include more than one binary.

    For example, the Cups daemon is the binary cupsd. It runs by calling it from the command line or from a cript (bootup, etc.) If you were to use it on its own, you would do
    Code:
     cupsd &
    (the & character returns you to the command line, w/o killing the daemon.)

    Now, a service can be something like the rc.mysqld service (talking about Slackware in particular.) It is a script that passes parameters to the daemon it invokes.

    So, the mysql daemon is just the binary mysqld. The rc.mysqld service is this:
    Code:
    #!/bin/sh
    # Start/stop/restart mysqld.
    #
    # Copyright 2003 Patrick J. Volkerding, Concord, CA
    # Copyright 2003 Slackware Linux, Inc., Concord, CA
    #
    # This program comes with NO WARRANTY, to the extent permitted by law.
    # You may redistribute copies of this program under the terms of the
    # GNU General Public License.
    
    # To start MySQL automatically at boot, be sure this script is executable:
    # chmod 755 /etc/rc.d/rc.mysqld
    
    # Before you can run MySQL, you must have a database.  To install an initial
    # database, do this as root:
    #
    #   su - mysql
    #   mysql_install_db
    #
    # Note that step one is becoming the mysql user.  It's important to do this
    # before making any changes to the database, or mysqld won't be able to write
    # to it later (this can be fixed with 'chown -R mysql.mysql /var/lib/mysql').
    
    # To disallow outside connections to the database (if you don't need them, this
    # is recommended to increase security), uncomment the next line:
    #SKIP="--skip-networking"
    
    # Start mysqld:
    mysqld_start() {
      if [ -x /usr/bin/mysqld_safe ]; then
        # If there is an old PID file (no mysqld running), clean it up:
        if [ -r /var/run/mysql/mysql.pid ]; then
          if ! ps ax | grep mysqld 1> /dev/null 2> /dev/null ; then
            echo "Cleaning up old /var/run/mysql/mysql.pid."
            rm -f /var/run/mysql/mysql.pid
          fi
        fi
        /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/run/mysql/mysql.pid $SKIP &
      fi
    }
    
    # Stop mysqld:
    mysqld_stop() {
      # If there is no PID file, ignore this request...
      if [ -r /var/run/mysql/mysql.pid ]; then
        killall mysqld
        # Wait at least one minute for it to exit, as we don't know how big the DB is...
        for second in 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 \
          0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 60 ; do
          if [ ! -r /var/run/mysql/mysql.pid ]; then
            break;
          fi
          sleep 1
        done
        if [ "$second" = "60" ]; then
          echo "WARNING:  Gave up waiting for mysqld to exit!"
          sleep 15
        fi
      fi
    }
    
    # Restart mysqld:
    mysqld_restart() {
      mysqld_stop
      mysqld_start
    }
    
    case "$1" in
    'start')
      mysqld_start
      ;;
    'stop')
      mysqld_stop
      ;;
    'restart')
      mysqld_restart
      ;;
    *)
      echo "usage $0 start|stop|restart"
    esac
    HTH

Similar Threads

  1. Clear Porn History
    By NewGuy in forum Linux - Software, Applications & Programming
    Replies: 18
    Last Post: 05-04-2009, 07:49 AM
  2. Definition of System and Boot Partition
    By regix in forum Windows - General Topics
    Replies: 0
    Last Post: 01-04-2005, 08:55 AM
  3. Clear text passwords
    By elovkoff in forum Windows - General Topics
    Replies: 8
    Last Post: 12-19-2003, 02:12 AM
  4. Konqueror - clear cache and URL's
    By Phaete in forum Linux - Software, Applications & Programming
    Replies: 2
    Last Post: 07-07-2002, 11:23 PM
  5. clear cache
    By nfallon in forum Linux - Software, Applications & Programming
    Replies: 2
    Last Post: 01-02-2002, 05:41 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •