• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

Loading daemon at startup/remote file downloads

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
psimation
Asked:
psimation
  • 2
1 Solution
 
samriCommented:
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
 
alien_life_formCommented:
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
 
psimationAuthor Commented:
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
 
alien_life_formCommented:
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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now