본문 바로가기
  • 아하하
개발/개발툴

Jenkins 설정

by 쥬쥬파파 2019. 3. 19.

jenkins에서 빌드툴을 가지고 톰켓 재구동 시킬때...

 

권한때문에 stop, start 가 잘안됌...

 

1. systemctl 서비스 등록

 

######################    /etc/systemd/system/tcit.service  #################################

Description=Apache Tomcat 8.5 Esales Servlet Container
After=syslog.target network.target

[Service]
User=root
Group=root
Type=forking
ExecStart=/home/TCIT/tomcat/bin/startup.sh
ExecStop=/home/TCIT/tomcat/bin/shutdown.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target:wq

######################################################################

 

    systemctl daemon-reload   서빗 리로드..

 

 

2. sudo visudo에 추가

 

    
jenkins ALL=(ALL) NOPASSWD:ALL
tomcat ALL=(ALL) NOPASSWD:ALL

 

 

하단에 추가.. NOPASSWD

 

3. Ant Task

    <exec executable="sudo">
       <arg line="-S systemctl restart tcit" />
  </exec>