Run supersocket with mono-service in Ubuntu

Source: Internet
Author: User

Recently, the server was developed with an open-source supersocket. I had a lot of detours when I had to run in mono. Now I will write out the solution and share it with you. If there are any shortcomings, please let us know.

Download the supersocket provided by jiangda.

File:

  

Check whether log4net. Unix. config exists in the config file and run it in mono. In mono, you can delete uninstallservice. BAT and installservice. bat, which are useless in Linux.

How can I configure supersocket.socketservice.exe. config and copy your DLL? Title = start % 20 supersocket % 20by % 20 Configuration

In mono, save the bash script I wrote as supersocket. Note that the case sensitivity and no file extension are copied to supersocket.socketservice.exe in the same directory.

Modify the path of service_path

#!/bin/sh # control supersocket like windows service. copy this to your Working directory then ./supersocket {start|stop|restart}#custom your servicenameSERVICENAME="SuperSocket"SERVICE_PID=""SERVICE_PATH="/root/SuperSocket/" #your Working directoryexport PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbinif [ -f "/var/run/${SERVICENAME}.pid" ]; then SERVICE_PID=$(cat /var/run/${SERVICENAME}.pid)ficase "$1" in  start)  if [ -z "${SERVICE_PID}" ]; then    mono-service -d:${SERVICE_PATH} -l:/var/run/${SERVICENAME}.pid -m:supersocket.log SuperSocket.SocketService.exe      echo "${SERVICENAME} running"  else    echo "${SERVICENAME} is already running!"  fi  ;;  stop)  if [ -n "${SERVICE_PID}" ]; then    kill ${SERVICE_PID}        echo "${SERVICENAME} stop success !"   else    echo "${SERVICENAME} is not running!"   fi   ;;  restart)       $0 stop       sleep 1       $0 start   ;;   *)       echo "usage: $0 {start|stop|restart}"esac exit 0

 

Check whether you have the script execution permission. If you do not have the 0755 permission to modify the script

Sudo chmod 755 supersocket script path

Right-click winscp

  

Use Putty to connect to a remote server

CD to the directory where your service runs

Execute the following command (make sure you are the root user. If not, add SUDO)

./Supersocket start

The supersocket service you wrote will run.

Start:./supersocket start stop:./supersocket stop restart:./supersocket restart. This is similar to the Service in the window.

  

About how to start automatically with the system.

Add the following command to the boot script of/etc/rc. Local or a class test:

Replace the corresponding directory

Your service directory/root/supersocket start

About detaching.

If you have added boot to the boot script, delete it.

If the service is running, stop it.

Delete the service directory.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.