Skip to content

Commit

Permalink
nixos/cron: Fix ShellCheck issue in preStart script
Browse files Browse the repository at this point in the history
Fixes the following warning when setting
`systemd.enableStrictShellChecks = true`:

> SC2174 (warning): When used with -p, -m only applies to the deepest
> directory.

Since it could conceivably be possible for `/var` to not exist when
running this script, the fix also explicitly tries to create /var with
the normal 0755 permissions.
  • Loading branch information
l0b0 committed Jan 4, 2025
1 parent a1945f7 commit 361c7f7
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion nixos/modules/services/scheduling/cron.nix
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ in
wantedBy = [ "multi-user.target" ];

preStart = ''
mkdir -m 710 -p /var/cron
(umask 022 && mkdir -p /var)
(umask 067 && mkdir -p /var/cron)
# By default, allow all users to create a crontab. This
# is denoted by the existence of an empty cron.deny file.
Expand Down

0 comments on commit 361c7f7

Please sign in to comment.