forked from facetostool/puppet-teamcity
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rudimentary support for Ubuntu 14.04 agents
- Loading branch information
Alex Box
committed
Nov 1, 2016
1 parent
9e779ca
commit 5ae4e25
Showing
2 changed files
with
88 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/sh - | ||
# File is managed by Puppet | ||
|
||
### BEGIN INIT INFO | ||
# Provides: teamcity_agent_<%= @agent_name %> | ||
# Required-Start: $local_fs $syslog | ||
# Required-Stop: | ||
# Default-Start: 2 3 4 5 | ||
# Default-Stop: 0 1 6 | ||
# Short-Description: TeamCity agent management script | ||
### END INIT INFO | ||
|
||
. /lib/lsb/init-functions | ||
|
||
NAME=teamcity_agent_<%= @agent_name %> | ||
DAEMON=/opt/teamcity_agent_<%= @agent_name %>/bin/agent.sh | ||
PIDFILE=/opt/teamcity_agent_<%= @agent_name %>/logs/teamcityAgent.pid | ||
USER=root | ||
|
||
# If the daemon is not there, then exit. | ||
test -x $DAEMON || exit 5 | ||
|
||
case $1 in | ||
start) | ||
if [ -e $PIDFILE ]; then | ||
status_of_proc -p $PIDFILE $DAEMON "$NAME process" >/dev/null && status="0" || status="$?" | ||
if [ $status = "0" ]; then | ||
log_daemon_msg "$NAME process is already running" | ||
exit | ||
fi | ||
fi | ||
|
||
log_daemon_msg "Starting the process" "$NAME" | ||
su --login -c "$DAEMON start" $USER || log_end_msg 1 | ||
;; | ||
stop) | ||
if [ -e $PIDFILE ]; then | ||
status_of_proc -p $PIDFILE $DAEMON "Stoppping the $NAME process" >/dev/null && status="0" || status="$?" | ||
if [ $status = "0" ]; then | ||
su --login -c "$DAEMON stop" $USER || log_end_msg 1 | ||
else | ||
log_daemon_msg "$NAME process is not running" | ||
log_end_msg 0 | ||
fi | ||
fi | ||
;; | ||
restart) | ||
$0 stop && sleep 2 && $0 start | ||
;; | ||
status) | ||
if [ -e $PIDFILE ]; then | ||
status_of_proc -p $PIDFILE $DAEMON "$NAME process" && exit 0 || exit $? | ||
else | ||
log_daemon_msg "$NAME Process is not running" | ||
log_end_msg 0 | ||
fi | ||
;; | ||
*) | ||
echo "Usage: $0 {start|stop|restart|status}" | ||
exit 2 | ||
esac |