The officially official Devuan Forum!

You are not logged in.

#1 2017-01-30 21:32:21

Registered: 2017-01-27
Posts: 11  

Creating a start and stop script for Nessus and nexpose

I just have installed Nessus vulnerability scanner on my devuan , and i notice that after the instalation no icons were created on the menu to start the service or stop it , this is important not only for this app but also for many others apps that load many computer resources and you are not already working on it .
This topic was created for those that use a specific app for 1 or 2 hours and then does not use it on that day for many more hours ahead and want to kill the services of that app to save computer resources .

I created a script for start for each app , and another script for stop for each app and have put them on (/usr/local/sbin) directory .

In case of  nessus , the scripts are called "nessus-start" & "nessus-stop"
for nexpose i used the same principle , witch is "nexpose-start" and "nexpose-stop"

The script to start nessus

service nessusd start
echo " Nessus service has started , reedirecting to nessus loginpage in 3 seconds"
sleep 3
open firefox ""

this last script initiates nessus script and redirect the user to nessus login page witch is on localmacine "" and the default port 8834 using https .

The script to stop nessus

echo "Stopping Nessus service"
service nessusd stop
echo "Service stopped"
sleep 3s

NOTE: you can add the shortucts to the main menu using this other topic i created
but using this code for command :

sh -c "cd /usr/local/sbin && ./nessus-start;${SHELL:bash}"

with this code the shell window will close automatically after all commands are done in the script , but if you want the shell opened after the script finish , then use this code :

sh -c "cd /usr/local/sbin && ./nessus-start;${SHELL:-bash}"

For Nexpose the scripts are diffent because nexpose starts multiple services , (postgresql , couchdb , etc...) .

The script to start nexpose in case was made in its default instalation directory (the default is : /opt/rapid7/nexpose)

echo " Starting Nexpose Service ,and redirecting you to nexpose login page"
echo "Nexpose services takes a minute to be operational , so refresh your browser in 1 minute"
service nexposeconsole start
sleep 4s
open firefox ""
cd /opt/rapid7/nexpose/nsc && ./

Nexpose is a very heavy app that takes sometime to load , around here it takes 1 minute until i get access to web login interface , so that was the reason i left that message in the bash script o user reload the page in one minute , and i started a 4 seconds pause after that so user can read the message .

The script to stop nexpose services

echo " Killing all processes related to nexpose"
service nexposeconsole stop
killall -u nxpgsql
kill $(ps aux | grep '' | awk '{print $2}')

This stop script kills all processes related to username created by rapid 7 installation for services "nxpgsql" , and kills the active terminal window where startup script is running (that must not be closed) .

You should aldo install chkconfig tool to remove those boot services from boot startup

 apt-get install chkconfig

and issue the command on terminal :

chkconfig nessusd off && chkconfig nexposeconsole off

Note2: I believe that this topic is not much related to devuan normal users , however system administrators use this tools to check vulnerabilities on their servers before someone outside do some harm to company web services .
I also post it because i may need it in a few months or years and i may not remember at that time how did i do it.

Last edited by pedropt (2017-01-30 23:36:16)


Board footer