Search code examples
servicedaemonubuntu-16.04ubuntu-server

Ubuntu 16.04 server custom service


There is a way for create custom service in ubuntu 16.04? I want something autostart at startup, manageable with service mycustomservice start

And the service should start a php websocket: (php ratchet)

php -f socket.php

Solution

  • try with supervisor enter link description here

    [program:ratchet]
    command                 = bash -c "ulimit -n 10000; exec /usr/bin/php ./bin/tutorial-terminal-chat.php"
    process_name            = Ratchet
    numprocs                = 1
    autostart               = true
    autorestart             = true
    user                    = root
    stdout_logfile          = ./logs/info.log
    stdout_logfile_maxbytes = 1MB
    stderr_logfile          = ./logs/error.log
    stderr_logfile_maxbytes = 1MB