Solved

Loading daemon at startup/remote file downloads

Posted on 2000-02-19
4
182 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
  • 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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
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 get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

706 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now