File tree 1 file changed +16
-1
lines changed
config/templates/metasploit-framework-wrappers
1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,18 @@ def tail(file)
28
28
File . readlines ( file ) . last . to_s . strip
29
29
end
30
30
31
+ def status_db
32
+ if Dir . exist? ( @db )
33
+ if system ( "#{ @pg_ctl } -o \" -p #{ @dbport } \" -D #{ @db } status > /dev/null" )
34
+ puts "Database started at #{ @db } "
35
+ else
36
+ puts "Database is not running at #{ @db } "
37
+ end
38
+ else
39
+ puts "No database found at #{ @db } "
40
+ end
41
+ end
42
+
31
43
def start_db
32
44
if Dir . exist? ( @db )
33
45
if system ( "#{ @pg_ctl } -o \" -p #{ @dbport } \" -D #{ @db } status > /dev/null" )
@@ -36,7 +48,7 @@ def start_db
36
48
puts "Starting database at #{ @db } "
37
49
system ( "#{ @pg_ctl } -o \" -p #{ @dbport } \" -D #{ @db } -l #{ @db } /log start > /dev/null" )
38
50
sleep ( 2 )
39
- unless system ( "#{ @pg_ctl } -D #{ @db } status > /dev/null" )
51
+ unless system ( "#{ @pg_ctl } -o \" -p #{ @dbport } \" - D #{ @db } status > /dev/null" )
40
52
print 'The database failed to start: '
41
53
puts tail ( "#{ @db } /log" )
42
54
loop do
@@ -190,6 +202,7 @@ Manage a metasploit framework database
190
202
#{ prog } init # initialize the database
191
203
#{ prog } reinit # delete and reinitialize the database
192
204
#{ prog } delete # delete database and stop using it
205
+ #{ prog } status # check database status
193
206
#{ prog } start # start the database
194
207
#{ prog } stop # stop the database
195
208
@@ -208,6 +221,8 @@ when 'reinit'
208
221
reinit_db
209
222
when 'delete'
210
223
delete_db
224
+ when 'status'
225
+ status_db
211
226
when 'start'
212
227
start_db
213
228
when 'stop'
You can’t perform that action at this time.
0 commit comments