File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
rootfs/etc/services.d/logrotate Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change 2
2
3
3
set -e # Exit immediately if a command exits with a non-zero status.
4
4
5
+ # Run hourly.
6
+ INTERVAL_IN_SECS=3600
7
+
5
8
# Make sure we appear with a proper name under `ps`.
6
9
if [ ! -L " $0 " ]; then
7
10
SV_NAME=" $( basename " $( pwd) " ) "
@@ -10,17 +13,16 @@ if [ ! -L "$0" ]; then
10
13
fi
11
14
12
15
log () {
13
- echo " [$( basename " $0 " ) ] $* "
16
+ if [ -n " ${1-} " ]; then
17
+ echo " [$( basename " $0 " ) ] $* "
18
+ else
19
+ while read OUTPUT; do
20
+ echo " [$( basename " $0 " ) ] $OUTPUT "
21
+ done
22
+ fi
14
23
}
15
24
16
25
log " starting..."
17
- while true ; do
18
- s6-applyuidgid -u $USER_ID -g $GROUP_ID -G ${SUP_GROUP_IDS:- $GROUP_ID } /usr/sbin/logrotate -s /config/logrotate.status /etc/logrotate.conf
19
- EXITVALUE=$?
20
- if [ $EXITVALUE != 0 ]; then
21
- log " exited abnormally with [$EXITVALUE ]"
22
- fi
23
- sleep 3600
24
- done
26
+ s6-applyuidgid -u $USER_ID -g $GROUP_ID -G ${SUP_GROUP_IDS:- $GROUP_ID } /usr/local/bin/watch -i " $INTERVAL_IN_SECS " /usr/sbin/logrotate -s /config/logrotate.status /etc/logrotate.conf | log
25
27
26
28
# vim:ft=sh:ts=4:sw=4:et:sts=4
You can’t perform that action at this time.
0 commit comments