0

I am new to Linux and its commands and I am trying to learn cron jobs. So, I created a cronjob that runs every minute.

* * * * * /home/vscoder/script.sh >> /var/log/cronjob.log 2>&1

I know that by default in Ubuntu cron job logs are stored in /var/log/syslog file but I am trying to save logs for my cron job in /var/log/cronjob.log file. But my cron logs are not stored in it, cronjob.log file is empty. Please refer below:

vscoder@vscoder-VirtualBox:/var/log$ cat cronjob.log
vscoder@vscoder-VirtualBox:/var/log$

What should I do so that my cron job logs will be stored in /var/log/cronjob.log file.

2
  • Is /var/log/cronjob.log writable by the user? You might want to choose a different location. Jun 25 '21 at 20:25
  • Hi @TobySpeight, thanks for your comment. I tried different directory /home/vscoder/cronjobs.log file and it worked. I think files stored in /var/log are not writable by user. Jun 26 '21 at 16:11

Browse other questions tagged or ask your own question.