Skip to content

Commit f8ab4e1

Browse files
authored
Redirect stderr from cron
1 parent d39466d commit f8ab4e1

File tree

2 files changed

+3
-3
lines changed
  • root/etc/s6-overlay/s6-rc.d
    • init-crontab-config
    • svc-cron

2 files changed

+3
-3
lines changed

root/etc/s6-overlay/s6-rc.d/init-crontab-config/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ for cron_user in abc root; do
1010
# if crontabs do not exist in config
1111
if [[ ! -f "/config/crontabs/${cron_user}" ]]; then
1212
# copy crontab from system
13-
if crontab -l -u "${cron_user}" >/dev/null; then
13+
if crontab -l -u "${cron_user}" >/dev/null 2>&1; then
1414
crontab -l -u "${cron_user}" >"/config/crontabs/${cron_user}"
1515
fi
1616

root/etc/s6-overlay/s6-rc.d/svc-cron/run

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/with-contenv bash
22
# shellcheck shell=bash
33

4-
if builtin command -v crontab >/dev/null && [[ -n "$(crontab -l -u abc)" || -n "$(crontab -l -u root)" ]]; then
5-
if builtin command -v busybox >/dev/null && [[ $(busybox) =~ [[:space:]](crond)([,]|$) ]]; then
4+
if builtin command -v crontab >/dev/null 2>&1 && [[ -n "$(crontab -l -u abc)" || -n "$(crontab -l -u root)" ]]; then
5+
if builtin command -v busybox >/dev/null 2>&1 && [[ $(busybox) =~ [[:space:]](crond)([,]|$) ]]; then
66
exec busybox crond -f -S -l 5
77
elif [[ -f /usr/bin/apt ]] && [[ -f /usr/sbin/cron ]]; then
88
exec /usr/sbin/cron -f -L 5

0 commit comments

Comments
 (0)