# 5.45 创建服务延时执行命令 以下以创建一个执行1分钟后关闭错误报警蜂鸣声的服务为例,用到了at定时执行,需要提前安装 延时服务:sudo apt install at 说明:事实上,延时执行是没有必要的,仅以此为例,用户可尝试修改ExecStart的脚本。 sudo dedit /etc/systemd/system/nobeep.service Requires=atd.service 添加内容: [Unit] Description=Keep quiet when some error happens Requires=atd.service [Service] Type=simple ExecStart=/bin/bash -c "echo /sbin/rmmod pcspkr |at now + 1 minutes" [Install] WantedBy=multi-user.target 启用自定义服务并测试判断: sudo systemctl enable nobeep.service systemctl list-dependencies nobeep.service --reverse sudo systemctl start nobeep.service systemctl status nobeep.service