Skip to content

Commit

Permalink
Add switch -f for foreground mode
Browse files Browse the repository at this point in the history
  • Loading branch information
w30023233 authored and t8m committed Mar 22, 2022
1 parent 299ef06 commit 00f1758
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions man/cron.8
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,9 @@ must not enable
.I pam_loginuid.so
module.
.TP
.B "\-f"
the same as -n, consistent with other crond implementations.
.TP
.B "\-p"
Allows
.I Cron
Expand Down
4 changes: 3 additions & 1 deletion src/cron.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ static void usage(void) {
fprintf(stderr, " -i deamon runs without inotify support\n");
fprintf(stderr, " -m <comm> off, or specify preferred client for sending mails\n");
fprintf(stderr, " -n run in foreground\n");
fprintf(stderr, " -f run in foreground, the same as -n\n");
fprintf(stderr, " -p permit any crontab\n");
fprintf(stderr, " -P inherit PATH from environment instead of using default value");
fprintf(stderr, " of \"%s\"\n", _PATH_DEFPATH);
Expand Down Expand Up @@ -690,13 +691,14 @@ static void sigchld_reaper(void) {
static void parse_args(int argc, char *argv[]) {
int argch;

while (-1 != (argch = getopt(argc, argv, "hnpsiPx:m:cV"))) {
while (-1 != (argch = getopt(argc, argv, "hnfpsiPx:m:cV"))) {
switch (argch) {
case 'x':
if (!set_debug_flags(optarg))
usage();
break;
case 'n':
case 'f':
NoFork = 1;
break;
case 'p':
Expand Down

0 comments on commit 00f1758

Please # to comment.