start up script for chat server

Discussion in 'HOWTO-Related Questions' started by grandpagenocide, Aug 9, 2007.

  1. grandpagenocide

    grandpagenocide ISPConfig Developer ISPConfig Developer

    ok, I have a chat server using visual chat, located in directory
    /var/www/web1/web/visualchat/chatserver

    to start the server: java -cp server.jar chat.ChatServer 6680 password

    how do i set it to start automatically?
     
  2. geekman

    geekman New Member

    Not sure what distro you are using, but i'll just assume a debian based system. You could add that line to the /etc/rc.local bash file, this way the script will be executed at each run level so it can be started at boot.

    Alternatively you could have a script like so...
    Code:
    #!/bin/sh
    # Chat server startup script.
    /path/to/java -cp server.jar chat.ChatServer 6680 password
    
    Put that in /etc/init.d/

    Then create a symlink to it in say /etc/rc2.d/
    Code:
    ln -s /etc/init.d/chat-start /etc/rc2.d/S20chat-start
    
    The number (S20) will dictate in what order in that runlevel the script will be executed.

    You could of course elaborate on that simple script to allow you to stop and restart it too.
     

Share This Page