LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Mandriva
User Name
Password
Mandriva This Forum is for the discussion of Mandriva (Mandrake) Linux.

Notices


Reply
  Search this Thread
Old 01-14-2004, 04:34 AM   #1
neverender
LQ Newbie
 
Registered: Feb 2003
Posts: 15

Rep: Reputation: 0
adding a service


i just put imapd and pop3 on my computer, i put them in the /usr/sbin directory.

now i want to add them as a service, how do i do that? i tried these -

% chkconfig --add imapd
error reading information on service imapd: No such file or directory
% chkconfig --add /usr/sbin/imapd
error reading information on service /usr/sbin/imapd: No such file or directory

i just want to add them as a service so they autmatically start when i restart, just like httpd and sshd do.

i'm sure its simple, i just cant figuere it out.
 
Old 01-14-2004, 05:13 AM   #2
scott_R
Member
 
Registered: Jul 2003
Location: Brighton, Michigan, USA
Distribution: Lots of distros in the past, now Linux Mint
Posts: 748

Rep: Reputation: 31
Yep, it's simple (I can do it...)

The best way is to figure out what Distro you're using, and use that distro's service "starter" for the items you've listed.

Unfortunately, it's hard to be detailed when you don't give the distro that you're using, so sorry I can't help in more detail. Webmin and Usermin might be some help, if you're familiar with them or have access to them through your distro.
 
Old 01-14-2004, 05:28 AM   #3
neverender
LQ Newbie
 
Registered: Feb 2003
Posts: 15

Original Poster
Rep: Reputation: 0
oh, i thought i posted it under the mandrake forums, isn't it assumed that i'm using mandrake (version 9.0 if you must know)?

anyways i think i found it. i used this link (http://www.mandrakeuser.org/docs/adm...t/service.html) and i have something going on, i just cant tell if its working yet or not.
 
Old 01-14-2004, 05:44 AM   #4
neverender
LQ Newbie
 
Registered: Feb 2003
Posts: 15

Original Poster
Rep: Reputation: 0
ok i found it, i just want to post the solution so future people can know how to do this too...

i had to make a simple "startup" service file and put it in my /etc/init.d/ directory.
frankly this thing was not simple, and it was a pain in my but and wanted every last sytax correct.

but in the end i just copied and modified the service file for the crond daemon.

the end result was this -
Code:
#! /bin/sh
# chkconfig: 2345 20 80
# description: runs the imapd daemon

#source function library.
if [ -f /etc/init.d/functions ] ; then
  . /etc/init.d/functions
elif [ -f /etc/rc.d/init.d/functions ] ; then
  . /etc/rc.d/init.d/functions
else
  exit 0
fi

# See how we were called.

prog="imapd"

start() {
        gprintf "Starting %s: " "$prog"
        /usr/sbin/imapd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ]
        return $RETVAL
}

stop() {
        gprintf "Stopping %s: " "$prog"
        killproc imapd
        RETVAL=$?
        echo
        [ $RETVAL -eq 0 ]
        return $RETVAL
}

rhstatus() {
        status imapd
}

restart() {
        stop
        start
}

reload() {
        gprintf "Reloading imap daemon configuration: "
        killproc imapd -HUP
        retval=$?
        echo
        return $RETVAL
}

case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart)
        restart
        ;;
  reload)
        reload
        ;;
  status)
        rhstatus
        ;;
  *)
        gprintf "Usage: %s {start|stop|status|reload|restart}\n" "$0"
        exit 1
esac

exit $?

i just took all that crap and put in a the file /etc/init.d/imapd, then made a similar one for the pop3 service.

heh... easy as that.... 400 simple steps to making a program run when you start your computer. i hate linux.

edit: oh yeah i forgot, after you do all that then you can run
% chkconfig --add imapd
and
% ntsysv
to set it up make the daemon run on startup.

Last edited by neverender; 01-14-2004 at 05:49 AM.
 
Old 01-14-2004, 06:25 AM   #5
jeffzw
Member
 
Registered: Jan 2004
Posts: 32

Rep: Reputation: 15
the startup files are usually created automatically if the guy who wrote the software provided you with a rpm package.
Otherwise, webmin can create these files for you.
Another solution might have to use xinetd to launch pop3 or imapd if you are not going to have a huge email load.
 
  


Reply



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
Adding a Service in inetd Icky_Joe Linux - Newbie 4 04-26-2005 09:05 AM
Adding new xinetd service Aldric Linux - Networking 1 06-03-2004 11:40 AM
adding a new daemon (service) vjenks Linux - Newbie 3 02-11-2004 07:31 PM
adding a program as a service neverender Linux - Software 2 01-14-2004 05:29 AM
Adding Service RedHat 9 green123 Linux - Newbie 4 08-26-2003 01:27 PM

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

All times are GMT -5. The time now is 12:17 AM.

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