Skip to content

Commit 584dc82

Browse files
committed
Create a startup.sh script to make the quote-mangling for the crontab generation a bit more clear
1 parent 2c21235 commit 584dc82

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

opensciencegrid/logrotate/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ RUN yum install -y crontabs \
1414
logrotate \
1515
&& yum clean all
1616

17-
CMD [ "sh", "-c", "echo \"$CRON_EXPR /usr/sbin/logrotate $LOGROTATE_OPTIONS $LOGROTATE_CONF\" '> /proc/$(cat /var/run/crond.pid)/fd/1 2>&1' | crontab - && crond -n"]
17+
COPY startup.sh /bin/
18+
CMD [ "/bin/startup.sh" ]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/bash
2+
3+
# Create a cron file on the fly based on docker environment variables,
4+
# Then immediately pipe it to crontab
5+
echo "$CRON_EXPR /usr/sbin/logrotate $LOGROTATE_OPTIONS $LOGROTATE_CONF" '> /proc/$(cat /var/run/crond.pid)/fd/1 2>&1' | crontab -
6+
7+
# Start cron in non-daemon (foreground) mode
8+
crond -n

0 commit comments

Comments
 (0)