XMailforum is a readonly knowledge archive now.

Registering as a new user or answering posts is not possible anymore.

Might the force be with you, to find here what you are looking for.

2019-09-20 - hschneider, Admin

Cookie Disclaimer: This forum uses only essential, anonymous session cookies (xmailforum*), nothing to be scared of.

XMail Forum -> Daemon Startup Script

Closed TopicStart new topicStart Poll

> Daemon Startup Script, For XQM Agent on Linux
hschneider
Posted: Mar 2 2004, 09:11 AM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



CODE

#!/bin/sh
#
# skeleton example file to build /etc/init.d/ scripts.
#  This file should be used to construct scripts for /etc/init.d.
#
#  Written by Miquel van Smoorenburg <miquels@cistron.nl>.
#  Modified by Harald Schneider <h_schneider@marketmix.com>
#
# Version: @(#)skeleton  1.8  03-Mar-1998  miquels@cistron.nl
#

# __Start_of_configuration__
#
# Place the path to your Agent's folder here:
#

AGENT_ROOT=/var/xqmagent

#
# __End_of_configuration__

LD_ASSUME_KERNEL="2.4.1"

PATH=$AGENT_ROOT:/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=$AGENT_ROOT/xqmagent
NAME=xqmagent
DESC="XQM Agent"

test -f $DAEMON || exit 0

set -e
ulimit -c 20000

start_agent()
{
 $DAEMON
}

stop_agent()
{
 killall -KILL $NAME
}

debug_agent()
{
 $DAEMON --debug
}


case "$1" in
 start)
     echo -n "Starting $DESC: "
     start_agent
;;
 stop)
     echo -n "Stopping $DESC: "
     stop_agent
     echo "Stopped!"
;;
 debug)
     echo "Debugging $DESC ... "
     debug_agent
;;
 restart|force-reload)
#
# If the "reload" option is implemented, move the "force-reload"
# option to the "reload" entry above. If not, "force-reload" is
# just the same as "restart".
#
echo -n "Restarting $DESC ... "
stop_agent
sleep 1
start_agent
;;
 *)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload|debug}" >&2
exit 1
;;
esac

exit 0



Just adapt the Agent's path and go ..


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
Sougent
Posted: Jul 8 2004, 02:19 AM
Quote Post


Newbie
*

Group: Members
Posts: 4
Member No.: 1205
Joined: 8-July 04



Hi,

I need the idiots guide to setting up startup scripts, I've created a copy of this XQM startup script but I can't get it to work.

Could someone give me step by step instructions for where to put this script and how to set it up so that it will run automatically when I boot up at run level 3?

If you haven't guessed, I'm new at this Linux thing and though I kinda understand the whole thing, I guess I'm missing a piece because for the life of me I can't get this to work.

Thanks,

newbie.gif
PMEmail Poster
Top
hschneider
Posted: Jul 8 2004, 06:11 AM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



In most distributions, this file (name it xqmagent) needs to go to
/etc/rc.d/init.d

cd /etc/rc.d/init.d
chmod 755 xqmagent
cd /etc/rc.d/rc3.d
ln -s /etc/rc.d/init.d/xqmagent S91xqmagent

Then reboot.

This creates a symbolic link in your runlevel folder, which points to the script.
The S91 prefix tells your system to start the agent right after XMail, which typically has S90 as prefix. The magic here is, that all filenames inside the runlevel folder are executed in alphabetical order.


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
Sougent
Posted: Jul 8 2004, 07:03 AM
Quote Post


Newbie
*

Group: Members
Posts: 4
Member No.: 1205
Joined: 8-July 04



QUOTE (hschneider @ Jul 8 2004, 06:11 AM)
In most distributions, this file (name it xqmagent) needs to go to
/etc/rc.d/init.d

cd /etc/rc.d/init.d
chmod 755 xqmagent
cd /etc/rc.d/rc3.d
ln -s /etc/rc.d/init.d/xqmagent S91xqmagent

Then reboot.

This creates a symbolic link in your runlevel folder, which points to the script.
The S91 prefix tells your system to start the agent right after XMail, which typically has S90 as prefix. The magic here is, that all filenames inside the runlevel folder are executed in alphabetical order.

Hi,

That worked, to a point, but it failed with a "no such file or directory" when it tried to come up on the reboot.

My xqmagent directory is /var/xqmagent, the AGENT_ROOT looks correct. Otherwise the script is exactly as posted here.

Any ideas?

Joe
PMEmail Poster
Top
hschneider
Posted: Jul 8 2004, 07:58 AM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



cd /etc/rc.d/init.d
./xqmagent start

Any messages after this ?
Which OS and distribution do you use ?


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
Sougent
Posted: Jul 10 2004, 10:17 PM
Quote Post


Newbie
*

Group: Members
Posts: 4
Member No.: 1205
Joined: 8-July 04



QUOTE (hschneider @ Jul 8 2004, 07:58 AM)
cd /etc/rc.d/init.d
./xqmagent start

Any messages after this ?
Which OS and distribution do you use ?


: bad interpreter: No such file or directoory


Fedora Core release 1 (Yarrow)
Kernel 2.4.22-1.2194.nptl


PMEmail Poster
Top
hschneider
Posted: Jul 10 2004, 11:20 PM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



This can mean several things. In fact the script cannot be executed.
Make sure that

- the 1st line of the script starts with #! and is not blank,
- that sh exists in your /bin folder and
- you don't use non-Unix lineendings in the case you've edited the script on Windows.


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
Sougent
Posted: Jul 11 2004, 02:29 AM
Quote Post


Newbie
*

Group: Members
Posts: 4
Member No.: 1205
Joined: 8-July 04



QUOTE (hschneider @ Jul 10 2004, 11:20 PM)
This can mean several things. In fact the script cannot be executed.
Make sure that

- the 1st line of the script starts with #! and is not blank,
- that sh exists in your /bin folder and
- you don't use non-Unix lineendings in the case you've edited the script on Windows.

Non-Unix line endings it was........

Everything works now except that when I run it from the command line it takes a good minute from the point it says Daemonized before it gives me back the command line.

Takes a long while when booting up too, but finally makes it through.

Thanks for your help.

wacko.gif
PMEmail Poster
Top
hschneider
Posted: Jul 11 2004, 08:53 AM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



This delay can be supressed in the next version. It starts scanning the queue on teh very first startup, which can take some time depending on your hardware.


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
dbatch
Posted: Apr 11 2005, 05:40 PM
Quote Post


Newbie
*

Group: Members
Posts: 17
Member No.: 1095
Joined: 3-May 04



RedHat Fedora requires

The following two lines in the startup scripts

chkconfig

and

description

These are some example lines from my xmail rc script, it should be the same for xqm


#!/bin/sh
#
# chkconfig: 2345 80 30
# description: Xmail server
#
#
PMEmail Poster
Top
hschneider
Posted: Apr 11 2005, 07:43 PM
Quote Post


No - I'm not an answering script ...
Group Icon

Group: Admin
Posts: 6631
Member No.: 195
Joined: 19-June 02



Thanks!


--------------------
Bye,
Harald


-- Download XMail Queue Manager 1.46 NOW: XMail Server Tools
-- Cross platform remote queue management!
-- Message analyzing on the fly!
-- Builtin diagnostics knowledge base!
-- Manages multiple mail queues!

Sponsored by
CD-Produktion und DVD-Produktion and Homestaging Saarland - Immobilien schneller verkaufen in der Region Saarland, Rheinland-Pfalz und Luxembourg
PMEmail PosterUsers Website
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:
« Next Oldest | XMail Queue Manager | Next Newest »

Closed TopicStart new topicStart Poll