当前位置:首页 > Linux > 正文内容

(原创)Ubuntu18注册lmgrd服务,实现开机自启动 Synopsys工具

chanra1n2年前 (2022-10-10)Linux2564

首先进入服务文件夹

cd /lib/systemd/system

然后新建service文件

sudo touch edatools.service

然后编辑为以下内容,其中路径以实际为准:

[Unit]
Description=Synopsys tools active service
After=network.target

[Service]
Type=forking
ExecStart=/usr/synopsys/active_tools.sh
ExecReload=/usr/synopsys/active_tools.sh
ExecStop=/usr/synopsys/active_tools.sh
PrivateTmp=true

[Install]
WantedBy=multi-user.target
Alias=edatools.service

然后新建对应的sh文件(注意,这里实际只实现了启动的功能,如果需要停止的,参考sh文件自己改)

#!/bin/bash
LOGTIME=$(date "+%Y-%m-%d %H:%M:%S")
echo "[$LOGTIME] startup run..." >>/root/startup_run.log
service ssh start >>/root/startup_run.log
echo "Detecting system status, please wait!"

rm -rf /tmp/lmstat.log
/usr/local/eda_tools/scl/2018.06/linux64/bin/lmstat >>/tmp/lmstat.log
if [ `grep -c "Cannot" /tmp/lmstat.log` -ne '0' ];then
    echo "Detected that the service is not running, trying to restart..."
    sudo kill -9 $(lsof -i:27000 -t)
    wait
    rm -rf /root/EDA_INITIAL.log
    cd /usr/local/eda_tools/scl/2018.06/linux64/bin && LD_PRELOAD=./snpslmd-hack.so ./lmgrd -c /usr/local/eda_tools/Synopsys.dat >> /root/EDA_INITIAL.log
    sleep 10s
    wait
    else
    echo "System service detected started!"
    exit 0
fi

rm -rf /tmp/lmstat.log
/usr/local/eda_tools/scl/2018.06/linux64/bin/lmstat >>/tmp/lmstat.log
if [ `grep -c "Cannot" /tmp/lmstat.log` -ne '0' ];then
    echo "Detected that the service is not running, trying to restart..."
    sudo kill -9 $(lsof -i:27000 -t)
    wait
    rm -rf /root/EDA_INITIAL.log
    cd /usr/local/eda_tools/scl/2018.06/linux64/bin && LD_PRELOAD=./snpslmd-hack.so ./lmgrd -c /usr/local/eda_tools/Synopsys.dat >> /root/EDA_INITIAL.log
    sleep 10s
    wait
    else
    echo "System service detected started!"
    exit 0
fi

rm -rf /tmp/lmstat.log
/usr/local/eda_tools/scl/2018.06/linux64/bin/lmstat >>/tmp/lmstat.log
if [ `grep -c "Cannot" /tmp/lmstat.log` -ne '0' ];then
    echo "It is detected that the service is not running, please contact the administrator..."
    exit 0
fi

然后运行

 sudo systemctl daemon-reload
 sudo systemctl enable edatools.service

就已经实现了开机启动程序。

如果需要立即开启服务,可以运行

service edatools start

也可以查看服务状态

service edatools status


扫描二维码推送至手机访问。

版权声明:本文由我的FPGA发布,如需转载请注明出处。

本文链接:https://myfpga.cn/index.php/post/284.html

分享给朋友:

“(原创)Ubuntu18注册lmgrd服务,实现开机自启动 Synopsys工具” 的相关文章

一键解决KALI中文乱码问题

一键解决KALI中文乱码问题

echo "deb http://mirrors.ustc.edu.cn/kali kali-rolling main non-free contrib" >> /etc/apt/sour...

Gi945/Fi945 BIOS 终极修改版 V1.6.7

Gi945/Fi945 BIOS 终极修改版 V1.6.7

点击直接下载:GI945.BIN另外附上原版有锁BIOSgi945有锁版.bin...

MW155R AR9331 刷机固件合集

MW155R AR9331 刷机固件合集

factory-to-ddwrt.binddwifi-ar71xx-generic-tl-wr710n-v1-squashfs-sysupgrade.binGECOOS_AP110T_QCA933X_5.6_2018102600.binlede-17.01.0-r3205-59508e3-ar71x...

小米路由器MINI刷爱快固件

小米路由器MINI刷爱快固件

uboot-xiaomi-mini-115200.binIK-MT7620AV4-H1S.bin...

仅IPV6的VPS安装AWVS 13.x 14.x 并使用DNS NAT服务访问IPV4网页 教程展示Ubuntu18.x环境配置

仅IPV6的VPS安装AWVS 13.x 14.x 并使用DNS NAT服务访问IPV4网页 教程展示Ubuntu18.x环境配置

测试通过的环境:centos7 Ubuntu18.x1、使用root登录vps2、打开DNS NAT服务,通过修改DNS解析文件设置echo -e "nameserver 2001:67c:2b0::4\nameserver 2001:67c:2b0...

在Ubuntu/Linux环境中用Python进行FPGA编程和OpenCL应用开发

在Ubuntu/Linux环境中用Python进行FPGA编程和OpenCL应用开发

随着FPGA (Field Programmable Gate Array) 技术的快速发展,越来越多的开发者开始使用Ubuntu或Linux环境进行FPGA的编程和开发工作。在本文中,我们将会介绍如何在Ubuntu/Linux环境中使用Python作为编程语言进行FPGA开发,以及如何在这些环境中...