Where are the cron logs in Debian 12?

I was setting up a simple bash script to automate by backups in my Debian server:

#!/usr/bin/evn bash

TIMESTAMP=$(date +%FT%T)
BACKUP_PATH="/mnt/full-backup"

TIMESTAMP=$(date +%FT%T)
echo "$TIMESTAMP: Starting backup..."

sudo tar -cvpzf $BACKUP_PATH/backup.tar.gz \
    --exclude=$BACKUP_PATH/backup.tar.gz \
    --exclude=/dev \
    --exclude=/mnt \
    --exclude=/proc \
    --exclude=/sys \
    --exclude=/tmp \
    --exclude=/media \
    --exclude=/run \
    --exclude=/lost+found \
    --one-file-system \
    /

TIMESTAMP=$(date +%FT%T)
if [ $? -eq 0 ]; then
    echo "$TIMESTAMP: Backup completed successfully"
else
    echo "$TIMESTAMP: Some error occurred during backup - error code: $?"
fi

I set it up to run every day at 2 AM with cron, but there was no backup file the next day. I searched through the usual logs, and weirdly I could not find/etc/rsyslog.conf to get the default log locations, nor I could find /var/log/syslog.

So, Debian 12 now uses journalctl instead of syslog. So all I had to do now was run:

journalctl -u cron.service

And I could finally identify that the authentication was failing. Problem solved.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.