Linux下的启动命令

Linux下的启动命令

我有一个在 cPanel 服务器(CentOS 6)上运行的自定义脚本,如下所示。它在指定端口上启动一项服务来接受传入数据。它用开始命令并运行正常。

#!/bin/bash
PORT_NUMBER=xxxx
echo "Start Time: $(date)"
if sudo netstat -altpn|grep xxxx | grep -q 'CLOSE_WAIT'; then
echo "Found Close Wait"
sudo stop comm
sleep 60
sudo stop comm
sudo lsof -i tcp:${PORT_NUMBER} | awk 'NR!=1 {print $2}' | xargs kill
sudo kill -9 $(sudo lsof -t -i:xxxx)
sleep 60
sudo start comm
fi
if [[ $(sudo lsof -t -i:2010) ]]; then
    echo "Service Running"
else
    echo "Restarting Service"
    sudo start comm
fi

哪个启动命令产生/sbin/start

我已将此脚本复制到装有 CentOS 7 的较新服务器上。当我尝试运行它时,出现以下错误。

Start Time: Mon Sep 20 12:09:36 UTC 2021
Restarting Service
sudo: start: command not found
End Time: Mon Sep 20 12:09:36 UTC 2021

我尝试搜索要安装的包,它提供了启动命令。我无法找到这样的包。有什么想法我需要在 CentOS 7 服务器上安装哪个软件包。

更新 通信作业在 /etc/init/comm.conf 中定义,并作为启动命令的参数进行调用。

description "Daemon Service running on port xxxx to receive device files"
author "xxxxxxxxxx"

start on startup
stop on shutdown
respawn

script
    [ $(exec /usr/bin/php -f /home/xxxxxxx/scripts/comm.php &>> /home/xxxxxxx/scripts/log.txt) = 'ERROR' ] && ( stop; exit 1; )
end script

相关内容