LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 09-07-2004, 06:16 PM   #1
Buto
Member
 
Registered: Sep 2004
Location: So Cal
Distribution: Slackware 12
Posts: 60

Rep: Reputation: 16
Starting daemon at boot up


I am running Slackware 10 using runlevel 3 and was wondering how to start two daemons on boot up, ie the Samba daemons. When I turn on my PC I want the daemons running without having to login, so the daemons are running when the login prompt appears.

Also how do I get these daemons running under a certain user, like when they spawn during boot up the belong to a user called Samba. Thanks for any help.
 
Old 09-07-2004, 07:18 PM   #2
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 271Reputation: 271Reputation: 271
For the Slackware correct way

You need something like this in your /etc/rc.d/rc.M file:

Code:
# Start Samba (a file/print server for Win95/NT machines).
# Samba can be started in /etc/inetd.conf instead.
if [ -x /etc/rc.d/rc.samba ]; then
  . /etc/rc.d/rc.samba start
fi

And then you need a file called rc.samba in /etc/rc.d/ that is executable:

Code:
#!/bin/sh
#
# /etc/rc.d/rc.samba
#
# Start/stop/restart the Samba SMB file/print server.
#
# To make Samba start automatically at boot, make this
# file executable:  chmod 755 /etc/rc.d/rc.samba
#

samba_start() {
  if [ -x /usr/sbin/smbd -a -x /usr/sbin/nmbd -a -r /etc/samba/smb.conf ]; then
    echo "Starting Samba:  /usr/sbin/smbd -D"
    /usr/sbin/smbd -D
    echo "                 /usr/sbin/nmbd -D"
    /usr/sbin/nmbd -D
  fi
}

samba_stop() {
  killall smbd nmbd
}

samba_restart() {
  samba_stop
  sleep 2
  samba_start
}

case "$1" in
'start')
  samba_start
  ;;
'stop')
  samba_stop
  ;;
'restart')
  samba_restart
  ;;
*)
  # Default is "start", for backwards compatibility with previous
  # Slackware versions.  This may change to a 'usage' error someday.
  samba_start
esac
And I'm not sure why you'd want samba to start as another user but you can pass a su <username> -c <command> for the actual command to start as another user, etc.

Also in slackware, if you installed Samba during initial install or used the tgz slackware packages to install Samba, you can edit your /etc/inetd.conf file as well to start the daemons.
 
Old 09-07-2004, 08:44 PM   #3
lupin_the_3rd
Member
 
Registered: Oct 2003
Location: Memphis, TN
Distribution: Slackware current
Posts: 485

Rep: Reputation: 30
if you installed samba just cd to /etc/rc.d and as root chmod 0755 rc.samba... sh rc.samba start and samba will be running and run at boot... this applies to any rc script in /etc/rc.d... the rc.M script is set up to start the scripts if they are excutable and to ignore them if not... pretty simple...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
still cant get nmb daemon starting eroica Linux - Networking 1 12-02-2004 08:42 PM
Howto stop daemon from starting Lawful Linux - General 3 04-30-2004 04:06 PM
Starting FTP Daemon baunemann Linux - Networking 4 03-14-2004 10:07 AM
Starting Up MySQL daemon tuka Linux - Software 2 08-06-2003 11:45 AM
Starting daemon during boot up chuck77 Linux - General 3 03-27-2002 06:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 06:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration