最近公司把jenkins搭建在windows上面,但是发布是要发布到linux服务器上,所以在自动部署上面会有执行shell命令的问题,遂找了一下;

发现jenkins有个shell脚本的插件:

shell plugin

This plugin executes shell commands remotely using SSH protocol.

安装这个插件,然后到构建任务里面选择构建,到构建后操作里面,会发现有一项是:

Excute shell script on remote host using ssh

选择这一项,然后会让你选择ssh主机,这里需要到jenkins的全局配置里面去配置ssh主机的用户及密码信息;

完成后,就可以通过这个插件执行远程主机的shell命令了;