MoYahoo1
(MoYahoo)
1
事情是这样的,最近在搞服务器的自动化性能测试,所以写了个shell脚本,自动启动来使用fio进行硬盘性能测试。
我写了一个systemd service文件,手动用 systemctl start 来启动是没有问题的,但是我使用systemctl enable it。
想达到一个使其自动开机测试然后测试完成后自动重启进行下一项测试的效果,不过enable之后重启系统没有任何效果。
显示以下内容:
● fio-test.service - fio automatic testing service
Loaded: loaded (/lib/systemd/system/fio-test.service; enabled)
Active: inactive (dead)
有谁可以给个看法嘛~先谢过 ![:smiley: :smiley:](//forums.debiancn.org/images/emoji/twitter/smiley.png?v=5)
MoYahoo1
(MoYahoo)
2
问题解决,最后发现是service文件编写的不对,原本的文件是这样的。
[code][Unit]
Description=fio automatic testing service
[Service]
Type=simple
ExecStart=/root/performance/test.sh
Restart=always
[Install]
Alias=fiotest.service
WantedBy=multi-user.target[/code]
把最后一句改为
WantedBy=default.target
就可以正常启动了。
MoYahoo1
(MoYahoo)
3