Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9125849
docker-run.erb
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
docker-run.erb
View Options
<%-
@required_start
=
[
"$network"
]
+
@sanitised_after_array
.
map
{
|
s
|
"
#{
@service_prefix
}#{
s
}
"
}
+
@sanitised_depends_array
.
map
{
|
s
|
"
#{
@service_prefix
}#{
s
}
"
}
+
@depend_services_array
@required_stop
=
[
"$network"
]
+
@sanitised_depends_array
.
map
{
|
d
|
"
#{
@service_prefix
}#{
d
}
"
}
+
@depend_services_array
-%>
#!/bin/sh
#
# This file is managed by Puppet and local changes
# may be overwritten
#
# /etc/rc.d/init.d/<servicename>
#
# Daemon for
<%=
@title
%>
#
# chkconfig: 2345 97 15
# description: Docker container for
<%=
@title
%>
### BEGIN INIT INFO
# Provides:
<%=
@service_prefix
%><%=
@sanitised_title
%>
# Required-Start:
<%=
@required_start
.
uniq
.
join
(
" "
)
%>
# Required-Stop:
<%=
@required_stop
.
uniq
.
join
(
" "
)
%>
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop docker container for
<%=
@title
%>
# Description: Docker container for
<%=
@title
%>
### END INIT INFO
if [ -e /etc/init.d/functions ]; then
. /etc/init.d/functions
elif [ -e /lib/lsb/init-functions ]; then
. /lib/lsb/init-functions
failure() {
log_failure_msg "$@"
return 1
}
success() {
log_success_msg "$@"
return 0
}
else
failure() {
echo "fail: $@" >&2
exit 1
}
success() {
echo "success: $@" >&2
exit 0
}
fi
export HOME=/root/
docker="/usr/bin/
<%=
@docker_command
%>
"
prog="
<%=
@service_prefix
%><%=
@sanitised_title
%>
"
if [ -d /var/lock/subsys ]; then
lockfile="/var/lock/subsys/$prog"
else
unset lockfile
fi
start() {
[ -x $docker ] || exit 5
if [ "true" = "$($docker inspect --format='{{.State.Running}}'
<%=
@sanitised_title
%>
2>/dev/null)" ]; then
failure
printf "Container
<%=
@sanitised_title
%>
is still running.\n"
exit 7
fi
printf "Starting $prog:\t"
<%=
@docker_run_inline_start
%>
retval=$?
echo
if [ $retval -eq 0 ]; then
success
else
failure
fi
}
stop() {
echo -n "Stopping $prog: "
<%=
@docker_run_inline_stop
%>
return $?
}
clean() {
if ! [ -f $cidfile ]; then
failure
echo
printf "$cidfile does not exist.\n"
else
cid="$(cat $cidfile)"
rm $cidfile
$docker rm -v -f $cid
retval=$?
return $retval
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
if [ "true" = "$($docker inspect --format='{{.State.Running}}'
<%=
@sanitised_title
%>
2>/dev/null)" ]; then
echo $prog is running
exit 0
else
echo $prog not running
exit 1
fi
;;
restart|reload)
stop
start
;;
clean)
clean
;;
cleanRestart)
stop
clean
start
;;
condrestart)
[ -f /var/lock/subsys/$prog ] && restart || :
;;
*)
echo "Usage: $0 [start|stop|status|reload|restart|probe|clean|cleanRestart]"
exit 1
;;
esac
exit $?
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Jun 21 2025, 9:25 PM (4 w, 2 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3388982
Attached To
R205 puppet-puppetlabs-docker
Event Timeline
Log In to Comment