Services Module

Botman

Compatibility:

Description

This module allows to (start|stop|restart) services on the system.
For GNU/Linux and FreeBSD, a configuration file must be written to know which commands to use for this.
For Windows machines, Microsoft exports an API to do it, so no configuration file is needed.

Configuration

If Botman is running on Windows, you don’t need to write a configuration file!
Example configuration file (/usr/local/etc/gotham/modules.conf.d/services.conf):

{
   "commands" : {
      "start" : "service %s start",
      "stop" : "service %s stop",
      "restart" : "service %s restart"
   }
}


Query botmans through Alfred

It is possible to make Alfred able to query botmans for you by combining the power of the spam and rewrite modules.
You can add the following JSON object as a new rule of the rewrite module’s configuration file:

{
   "name":     ".service",
   "filter":   ".service*",
   "rule":     "sed -r 's/^.service *([^ ]*) +(.*)/.spam \\1 .service \\2/'",
   "description": ".service <pattern> <serviceparameter> <servicename>"
}

Commands

(11:18:30) guillaume.friloux@botman.master.com: .service start YYYY
(11:18:31) botman-xxxx:: Service started
(11:18:36) guillaume.friloux@botman.master.com: .service stop YYYY
(11:18:37) botman-xxxx:: Service is stopping
(11:18:45) guillaume.friloux@botman.master.com: .service restart YYYY
(11:18:46) botman-xxxx:: Service restarted
.service status will only work on windows, ATM.
If you try it on any other OS, it will stop the service.
(16:41:32) guillaume.friloux@botman.master.com: .service status YYYY
(16:41:32) botman-xxxx:: The service is running.