Software / code / prosody
Comparison
prosodyctl @ 1089:a817cbaa0f46
prosodyctl: Multiple fixes for start/status/stop
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sat, 02 May 2009 17:48:28 +0100 |
| parent | 1087:5e9475bec571 |
| child | 1102:c81df501fd38 |
comparison
equal
deleted
inserted
replaced
| 1087:5e9475bec571 | 1089:a817cbaa0f46 |
|---|---|
| 236 | 236 |
| 237 show_message(error_messages[msg]) | 237 show_message(error_messages[msg]) |
| 238 return 1; | 238 return 1; |
| 239 end | 239 end |
| 240 | 240 |
| 241 function commands.start() | 241 function commands.start(arg) |
| 242 if arg[1] == "--help" then | |
| 243 show_usage([[start]], [[Start Prosody]]); | |
| 244 return 1; | |
| 245 end | |
| 242 local ok, ret = prosodyctl.isrunning(); | 246 local ok, ret = prosodyctl.isrunning(); |
| 243 if not ok then | 247 if not ok then |
| 244 show_message(error_messages[ret]); | 248 show_message(error_messages[ret]); |
| 245 return 1; | 249 return 1; |
| 246 end | 250 end |
| 262 show_message("Failed to start Prosody"); | 266 show_message("Failed to start Prosody"); |
| 263 show_message(error_messages[ret]) | 267 show_message(error_messages[ret]) |
| 264 return 1; | 268 return 1; |
| 265 end | 269 end |
| 266 | 270 |
| 267 function commands.status() | 271 function commands.status(arg) |
| 272 if arg[1] == "--help" then | |
| 273 show_usage([[status]], [[Reports the running status of Prosody]]); | |
| 274 return 1; | |
| 275 end | |
| 276 | |
| 268 local ok, ret = prosodyctl.isrunning(); | 277 local ok, ret = prosodyctl.isrunning(); |
| 269 if not ok then | 278 if not ok then |
| 270 show_message(error_messages[ret]); | 279 show_message(error_messages[ret]); |
| 271 return 1; | 280 return 1; |
| 272 end | 281 end |
| 278 show_message(error_messages[ret]); | 287 show_message(error_messages[ret]); |
| 279 return 1; | 288 return 1; |
| 280 end | 289 end |
| 281 show_message("Prosody is running with PID %s", ret or "(unknown)"); | 290 show_message("Prosody is running with PID %s", ret or "(unknown)"); |
| 282 return 0; | 291 return 0; |
| 283 end | 292 else |
| 284 return 1; | 293 show_message("Prosody is not running"); |
| 285 end | 294 return 2 |
| 286 | 295 end |
| 287 function commands.stop() | 296 return 1; |
| 297 end | |
| 298 | |
| 299 function commands.stop(arg) | |
| 300 if arg[1] == "--help" then | |
| 301 show_usage([[stop]], [[Stop a running Prosody server]]); | |
| 302 return 1; | |
| 303 end | |
| 304 | |
| 288 if not prosodyctl.isrunning() then | 305 if not prosodyctl.isrunning() then |
| 289 show_message("Prosody is not running"); | 306 show_message("Prosody is not running"); |
| 290 return 1; | 307 return 1; |
| 291 end | 308 end |
| 292 | 309 |
| 293 local ok, ret = prosodyctl.stop(); | 310 local ok, ret = prosodyctl.stop(); |
| 294 if ok then return 0; end | 311 if ok then return 0; end |
| 295 | 312 |
| 296 show_message(error_messages[ret]) | 313 show_message(error_messages[ret]); |
| 297 return 1; | 314 return 1; |
| 298 end | 315 end |
| 299 | 316 |
| 300 -- ejabberdctl compatibility | 317 -- ejabberdctl compatibility |
| 301 | 318 |