0

I'm using the following command to add a script to crontab:

sudo echo "*/1 * * * * /home/centos/fecha.sh" | sudo crontab -u centos -

However, when I try adding a second script,

sudo echo "*/3 * * * * /home/centos/fecha3.sh" | sudo crontab -u centos -

crontab will erase the previous one. I have tried different things (e.g. single line or using cat instead of echo) but I cannot figure out to do this in a simple and straightforward fashion.

afernandezody
  • 27
  • 1
  • 6
  • Or perhaps [How to programmatically add new crontab file without replacing previous one?](https://unix.stackexchange.com/q/241118/100397) – roaima Jun 22 '21 at 21:31
  • Or alternatively [How do I add/remove cron jobs by script?](https://unix.stackexchange.com/q/363376/100397) – roaima Jun 22 '21 at 21:31

0 Answers0