0

I have two files where in I have listed my cronjobs:

cron.dev1.txt
cron.dev2.txt

Now I am using crontab in the following manner:

crontab cron.dev1.txt and

crontab cron.dev2.txt

When I do crontab -e, I see that only the jobs listed in crontab cron.dev2.txt are listed. It seems that first the jobs in crontab cron.dev1.txt are loaded and then replaced by crontab cron.dev2.txt.

Is there a way to load jobs using crontab listed in several different files.?

kosta
  • 163
  • 1
  • 2
  • 7

1 Answers1

2

The crontab(1) man page notes you can populate the crontab via stdin:

  The  first  form  of this command is used to install a new crontab from
  some named file or standard  input  if  the  pseudo-filename  ``-''  is
  given.

So we can do this:

$ cat cron.dev1.txt
* * * * * /bin/script1
$ cat cron.dev2.txt
* * * * * /bin/script2
$ cat cron.dev*.txt | crontab -
$ crontab -l
* * * * * /bin/script1
* * * * * /bin/script2
$
Karen B
  • 534
  • 3
  • 7