#!/bin/bash

echo "安装服务..."
cat << ENOF >> /lib/systemd/system/rc-local.service
[Install]
WantedBy=multi-user.target
ENOF

echo "增加开机启动执行脚本..."
cat << ENOF > /etc/rc.local
#!/bin/bash
virsh_agent --daemon
ENOF

echo "设置权限..."
sudo chmod +x /etc/rc.local

echo "启动服务..."
systemctl enable rc-local.service

echo "查看服务状态..."
systemctl status rc-local.service

rm -rf ./auto_startup.sh
echo "====done!"