[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 432
  • Last Modified:

Configuring a new service to run on startup On RedHat Ent4

On RedHad Ent4.0,  I currently start this program from the command line with two options,  Deamon Mode and listen on port 443.
I don't know linux . . . . how do I get this to run on startup ?   Please explain it like you would to your mother . . . thanks  

        /opt/nessus/sbin/nessusd -D -p443
0
swbruce21
Asked:
swbruce21
  • 3
  • 2
  • 2
2 Solutions
 
pjedmondCommented:
Easy option is to add the above command line to /etc/rc.local

After all the main daemon scripts are run, this file is executed, and all the commands in it (including the above line that you are about to add) are run.

Voila... :)

0
 
m1tk4Commented:
On a redhat, you'll be much better of by installing Nessus as an RPM and starting it as all services are supposed to be started, i.e. through /etc/init.d.

http://www.nessus.org/documentation/nessus_3.0_installation_guide.pdf

If you did use an RPM, try if

service nessusd start

works. If it does, all you have to do is enable it by default. run

ntsysv

from command line and scroll down in the list of services until you see nessusd. The services that have [*] start by default, the ones that have [ ] don't. To switch it to start by default press space. Quit ntsysv with saving.

Another way to check if it's enabled by default is:

chkconfig --list | grep nessus

SHould output something like this:

nessusd        0:off   1:off   2:off   3:off   4:off   5:off   6:off

You need to enable it to run in levels 3 and 5, this is done by

chkconfig --level 3 nessusd on
chkconfig --level 5 nessusd on

and then check it again with chkconfig --list | grep nessus
0
 
swbruce21Author Commented:
Re: Comment from m1tk4

That is how it is installed, however the listening port number is hardwired into the executable and I need a different port number in order to reach this nessus server when confined in an environment that only permits outbout access on 80 and 443.

The alternate listening port is a switch option . . . can that be implemented in the manner that you suggest ?

Thanks
0
Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

 
m1tk4Commented:
yes, there has to be a way - can you post the contents of /etc/rc.d/init.d/nessusd here?
0
 
swbruce21Author Commented:
#!/bin/sh
#
# chkconfig: - 90 34
# description: Starts and stops the Nessus Scanner
#


# 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

# Avoid using root's TMPDIR
unset TMPDIR

# Source networking configuration.
. /etc/sysconfig/network


# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0


test -x /opt/nessus//sbin/nessusd || {
      echo "Nessus not properly installed"
      exit 1
      }

RETVAL=0
Here it is.  The -q switch shown below  is  documented with the other command line options

start() {
        KIND="Nessus"
      echo -n $"Starting $KIND services: "
      daemon /opt/nessus//sbin/nessusd -q -D
      RETVAL=0
      echo
      return 0
}      

stop() {
        KIND="Nessus"
      echo -n $"Shutting down $KIND services: "
      test -f /opt/nessus//var/nessus/nessusd.pid && kill `cat /opt/nessus//var/nessus/nessusd.pid`
      RETVAL=$?
      sleep 4
      echo
      return 0
}      

restart() {
      stop
      start
}      


case "$1" in
  start)
        start
      ;;
  stop)
        stop
      ;;
  restart)
        restart
      ;;
  *)
      echo $"Usage: $0 {start|stop|restart}"
      exit 1
esac

exit $?
0
 
pjedmondCommented:
Well that's easy - change:

    daemon /opt/nessus/sbin/nessusd -q -D

to be:

   daemon /opt/nessus/sbin/nessusd -q -D -p443

in the start() routine.

0
 
swbruce21Author Commented:
Thanks guys.  After being pointed to the /etc/rc.d/init.d/nessusd script the problem was solved.  Splitting the points equally because I appreciate the help from both.  
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

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