# ems_backend

后端

```bash
cd /home/lichang/ems_backend
go mod download
cd restagent/
# 打包命名 omcDevApp
go build -ldflags="-s -w" -o omcDevApp

# 启动
./omcDevApp -c dev.yaml --env local

nohup ./omcDevApp -c ./dev.yaml > ./dev.log 2>&1 &

# 查找进程并杀死
kill -9 $(ps aux | grep "omcDevApp" | grep -v grep | awk '{print $2}')
ps aux | grep omcDevApp
```

```bash
ps aux | grep "omcDevApp"

process_id=$(ps aux | grep "omcDevApp" | grep -v grep | awk '{print $2}')
if [ -n "$process_id" ]; then
  kill -9 "$process_id"
else
  echo "未找到匹配的进程"
fi

go version
go mod download

cd restagent/
go build -ldflags="-s -w" -o omcDevApp

BUILD_ID=dontKillMe
nohup ./omcDevApp -c ./dev.yaml > ./dev.log 2>&1 &
echo ok

```


## Docker

docker build --build-arg VERSION=240110 -t omc:240110 .

docker run -it omc:240110 sh

-v /var/log/omc
-v /etc/nginx
-v /usr/local/omc/etc
-v /usr/local/omc/static
-v /usr/local/omc/upload

docker run -d \
--privileged=true \
--restart=always \
-p 3222:22 \
-p 3280:80 \
-p 3230:3030 \
-e TZ="Asia/Shanghai" \
-m 512M \
--name omc_001 \
omc:240115