Mongodb 位置/etc/init.d/Mongodb.sh

#!/bin/sh
#chkconfig: 2345 80 90
#description: mongodb#!/bin/sh
#chkconfig: 2345 80 90
#description: mongodb
start() {
/usr/software/mongodb/bin/mongod --config /usr/software/mongodb/conf/mongo.conf
echo "mongodb start"
}
stop()
{
/usr/software/mongodb/bin/mongod --config /usr/software/mongodb/conf/mongo.conf --shutdown
echo "mongodb stop"
}
case "$1" in
    start)
        start
        ;;
    stop)
stop
;;
restart)
    stop
    start
    ;; 

esac
service Mongodb.sh start|stop|restart

 

 

Redis 位置/etc/init.d/Redis.sh

#!/bin/sh
#
# Simple Redis init.d script conceived to work on Linux systems
# as it does use of the /proc filesystem.

### BEGIN INIT INFO
# Provides:     redis_6379
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Redis data structure server
# Description:          Redis data structure server. See https://redis.io
### END INIT INFO

REDISPORT=6379
EXEC=/usr/software/redis/bin/redis-server
CLIEXEC=/usr/software/redis/bin/redis-cli

PIDFILE=/var/run/redis_${REDISPORT}.pid
CONF="/usr/software/redis/bin/conf/redis.conf"

case "$1" in
    start)
        if [ -f $PIDFILE ]
        then
                echo "$PIDFILE exists, process is already running or crashed"
        else
                echo "Starting Redis server..."
                $EXEC $CONF
        fi
        ;;
    stop)
        if [ ! -f $PIDFILE ]
        then
                echo "$PIDFILE does not exist, process is not running"
        else
                PID=$(cat $PIDFILE)
                echo "Stopping ..."
                $CLIEXEC -p $REDISPORT shutdown
                while [ -x /proc/${PID} ]
                do
                    echo "Waiting for Redis to shutdown ..."
                    sleep 1
                done
                echo "Redis stopped"
        fi
        ;;
    *)
        echo "Please use start or stop as first argument"
        ;;
esac
service Redis.sh start|stop

 

 

dotent Core app   位置/etc/systemd/system/DataCollect_Service.Service

[Unit]
Description=DataCollect_Service
 
[Service]
WorkingDirectory=/usr/software/datacollect
ExecStart=nohup /usr/bin/dotnet /usr/software/datacollect/DataCollect_Service.dll //应用程序未知
Restart=always
# Restart service after 10 seconds if the dotnet service crashes:
RestartSec=10
#SyslogIdentifier=dotnet-example
SyslogIdentifier=dotnet core console
User=root
#Environment=ASPNETCORE_ENVIRONMENT=Development
Environment=ASPNETCORE_ENVIRONMENT=Production
[Install]
WantedBy=multi-user.target
systemctl start|stop DataCollect_Service

 

posted on 2022-04-25 12:59  金科许俊  阅读(91)  评论(0编辑  收藏  举报