Skip to content

Commit

Permalink
Merge pull request #519 from splunk/feature/simplify-unitfiles
Browse files Browse the repository at this point in the history
Improve startup process
  • Loading branch information
Ryan Faircloth authored and GitHub committed Jun 13, 2020
2 parents f467d63 + 5928368 commit 26743b2
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
9 changes: 2 additions & 7 deletions docs/gettingstarted/docker-systemd-general.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,8 @@ Environment="SC4S_LOCAL_CONFIG_MOUNT=-v /opt/sc4s/local:/opt/syslog-ng/etc/conf.
TimeoutStartSec=0
Restart=always

ExecStartPre=/usr/bin/docker pull $SC4S_IMAGE
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment SC4SHOST=$(hostname -s)"
ExecStartPre=/usr/bin/docker run \
--env-file=/opt/sc4s/env_file \
"$SC4S_LOCAL_CONFIG_MOUNT" \
--name SC4S_preflight \
--rm $SC4S_IMAGE -s
ExecStart=/usr/bin/docker run -p 514:514 -p 514:514/udp -p 6514:6514 \
ExecStart=/usr/bin/docker run –pull=always -p 514:514 -p 514:514/udp -p 6514:6514 \
-e "SC4S_CONTAINER_HOST=${SC4SHOST}" \
--env-file=/opt/sc4s/env_file \
"$SC4S_PERSIST_VOLUME" \
Expand All @@ -68,6 +62,7 @@ ExecStart=/usr/bin/docker run -p 514:514 -p 514:514/udp -p 6514:6514 \
"$SC4S_TLS_DIR" \
--name SC4S \
--rm $SC4S_IMAGE
Restart=on-success
```

* Execute the following command to create a local volume that will contain the disk buffer files in the event of a communication
Expand Down
9 changes: 2 additions & 7 deletions docs/gettingstarted/podman-systemd-general.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,8 @@ Environment="SC4S_LOCAL_CONFIG_MOUNT=-v /opt/sc4s/local:/opt/syslog-ng/etc/conf.
TimeoutStartSec=0
Restart=always

ExecStartPre=/usr/bin/podman pull $SC4S_IMAGE
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment SC4SHOST=$(hostname -s)"
ExecStartPre=/usr/bin/podman run \
--env-file=/opt/sc4s/env_file \
"$SC4S_LOCAL_CONFIG_MOUNT" \
--name SC4S_preflight \
--rm $SC4S_IMAGE -s
ExecStart=/usr/bin/podman run -p 514:514 -p 514:514/udp -p 6514:6514 \
ExecStart=/usr/bin/podman run –pull=always -p 514:514 -p 514:514/udp -p 6514:6514 \
-e "SC4S_CONTAINER_HOST=${SC4SHOST}" \
--env-file=/opt/sc4s/env_file \
"$SC4S_PERSIST_VOLUME" \
Expand All @@ -87,6 +81,7 @@ ExecStart=/usr/bin/podman run -p 514:514 -p 514:514/udp -p 6514:6514 \
--name SC4S \
--rm $SC4S_IMAGE
ExecStartPost=sleep 2 ; conntrack -D -p udp
Restart=on-success
```

* Execute the following command to create a local volume that will contain the disk buffer files in the event of a communication
Expand Down
8 changes: 8 additions & 0 deletions package/sbin/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ echo syslog-ng starting

/opt/syslog-ng/sbin/syslog-ng $@ &
pid="$!"
sleep 5
if ! ps -p $pid > /dev/null
then
echo "syslog-ng failed to start $pid is not running"
exit $(wait ${pid})
# Do something knowing the pid exists, i.e. the process with $PID is running
fi

# wait forever
if [[ $@ != *"-s"* ]]; then
while true
Expand Down

0 comments on commit 26743b2

Please sign in to comment.