Solved

Loading daemon at startup/remote file downloads

Posted on 2000-02-19
4
187 Views
Last Modified: 2013-12-15
How do you load a daemon automatically at startup ( apachectl). I installed apache manually after installation and obviously it is not in the list of startup services under "setup"
2nd, Is it possible to do a 'background" ftp operation, like downloading. I want to be able to telnet into my Linux server from a remote location and then start ftp downloads via telnet, but i need to log out again without the download stopping.
thanks.
0
Comment
Question by:psimation
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 15

Expert Comment

by:samri
ID: 2538286
psimation,
    To enable automatic startup of your Apache, you need to create a startup scripts in /etc/rc3.d (the path may vary depending on the Unix variance).  Perhaps a simple script like

   #!/bin/sh
   /usr/local/apache/bin/apachectl start

  will get the job done.  

  If you want to get a better (standard) scripts, you can look at the existing one and modify to fit you need.  It's quite simple.

For your second question:  There is a utility, which I'm not sure whether it's bundled with you Linux distribution, called screen.  To check, just type screen at the command prompt, or you can browse thru you package tools for it.

If you still can find it, you can browse to Metalab,
      http://metalab.unc.edu/pub/gnu/screen/
  to download the source.  You need to compile and install it on your system.

Screen will enable you to run processes and you can detach your login session while maintaining you processes to be running (won't killed upon login).

     Once you logged in, just type screen to invoke it (screen -help to get a list of options), and whenever you want to log out, just hit Ctrl-A-D, to detach you active screen.   The detached screen can be reattach by running screen -r (screen -list will list all available screen, screen -r <screen process id> will restore the respective screen running under that PPID).

good luck,

samri
0
 
LVL 3

Expert Comment

by:alien_life_form
ID: 2542581
Greetings.

For number two, I would advise wget as in:

$ wget ftp://user:password@ftp.fubar.com/file/path/ark.tgz

It does multiple tries, restarts and the works in general.

Cheers,
   alf
0
 
LVL 17

Author Comment

by:psimation
ID: 2542651
in /etc I have a rc.d dir, under which I have rc0.d to rc6.d plus a couple of other dirs. In rc3.d I have a whole bunch of files, eg. K10pulse, K84apmd, S99linuxconf etc.
If I understand you correctly, i should use a normal text editor and create a file with #!/bin/sh
/usr/local/apache/bin/apachectl start

What should I name this file?
Does it matter?
0
 
LVL 3

Accepted Solution

by:
alien_life_form earned 100 total points
ID: 2542917
Mhh...
Looks to me that what you have is a redhat. If so, you may already have
a /etc/rc.d/init.d/httpd and you should probably modify that.

The files you see under /etc/rc.d/rcx.d/
are in fact symlinks to the files in
/etc/rc.d/init.d/.

When entering a given runlevel (the x in rcx.d), init invokes the S* files with a 'start' argument, the K* files with a 'stop' argument.

So you should create a, say,  /etc/rc.d/init.d/apache script along the lines of:

case "$1" in
start)
    echo -n "Apache starting"
   /usr/local/apache/bin/apachectl start
;;
stop)
 
    echo -n "Apache stopping"
   /usr/local/apache/bin/apachectl stop
;;

reload)
.....

Then symlink as say S99apache under rc{3,4,5}.d and K10apache under rc{2,1,0}.d.

But wait, there is more. All this symlinking (and unlinking) is a drag.

RH has a convenient, but little advertised, /sbin/chkconfig command that will take that pain on itself.
To make it work, though, you have to write the above script abiding by some commenting conventions (a comment line like:
# chkconfig 345 85 15
near the beginning of the script should do it).

Then you can do:

#chkconfig --list apache
#chkconfig --levels 345 apache on
#chkconfig --default apache

and al the {un}linking  will be done automagically.

Cheers,
   alf

0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

691 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