我正在尝试在我的虚拟机启动时运行zabbix代理
我的cloudinit.txt(部分内容)像这样: -
runcmd:
- [ ls, -l, / ]
- [ ls, -l, /usr ]
- [ sudo service zabbix-agent restart ]
我得到了
cloud-init[1025]: lrwxrwxrwx. 1 root root 10 Dec 1 13:05 tmp -> ../var/tmp
cloud-init[1025]: /var/lib/cloud/instance/scripts/runcmd: line 4: sudo service zabbix-agent restart: command not found
cloud-init[1025]: 2015-03-01 07:04:14,307 - util.py[WARNING]: Failed running /var/lib/cloud/instance/scripts/runcmd [127]
cloud-init[1025]: 2015-03-01 07:04:14,316 - cc_scripts_user.py[WARNING]: Failed to run module scripts-user (scripts in /var/lib/cloud/instance/scripts)
cloud-init[1025]: 2015-03-01 07:04:14,316 - util.py[WARNING]: Running scripts-user (<module 'cloudinit.config.cc_scripts_user' from '/usr/lib/python2.7/site-packages/cloudinit/config/cc_scripts_user.pyc'>) failed
大多数命令都有效(我能够列出目录) 但服务没有启动,我在日志中得到这个: -
sudo service zabbix-agent restart: command not found
如果我登录,y vm ..我可以使用相同的命令启动它
答案 0 :(得分:0)
由于我在使用centos,我最终使用了:
systemctl enabled zabbix-agent.service