3

I have followed the steps in this tutorial but it wouldn't work.

https://serversforhackers.com/setting-up-mailcatcher

I did however successfully installed mailcatcher and have tested. It is working, however I can't run it as a service.

Anyone knows how to do this in CentOS? Thanks.

TheGPWorx
  • 857
  • 3
  • 17
  • 37

1 Answers1

6

All operations made by root or sudoer user.

  1. create file /etc/init.d/mailcatcher
  2. add to it this content (from https://gist.github.com/oppara/c4233b289c86e2b3cb66) :

    
    #!/bin/sh
    # chkconfig: 345 99 1
    # description: mailcatcher
    # processname: mailcatcher
    
    start() {
        echo -n "starting mailcatcher:"
        /usr/local/rbenv/shims/mailcatcher --http-ip=0.0.0.0
        return 0
    }
    
    stop() {
        killall mailcatcher
        return 0
    }
    
    case "$1" in
        start)
            start
            ;;
        stop)
            stop
            ;;
        *)
            echo $"Usage: $0 {start|stop}"
            exit 2
    esac
    
    exit 0
    
    
  3. make file executable:

    chmod +x /etc/init.d/mailcatcher
  4. add service available:

    chkconfig --add mailcatcher
  5. enable service:

    chkconfig mailcatcher on
  6. start or stop service with this command:

    service mailcatcher stop|start
markux
  • 91
  • 1
  • 5