Cronjobs not executing

kalekulan

New Member
Aug 3, 2024
2
0
1
Hi,

I'm trying to setup a nightly cronjob to put my server to sleep. It doesn't execute, but works fine using the command line.

Syslog doesn't give me anything, neither does journalctl. I tried increasing the log level but that doesn't change things either.


Bash:
➜crontab -e
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; }
47 6    * * 7   root    test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
52 6    1 * *   root    test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; }
27 11   * * *   root    /usr/sbin/rtcwake -m off -s 60


Bash:
➜cat /etc/default/cron
# Cron configuration options

# Whether to read the system's default environment files (if present)
# If set to "yes", cron will set a proper mail charset from the
# locale information. If set to something other than 'yes', the default
# charset 'C' (canonical name: ANSI_X3.4-1968) will be used.
#
# This has no effect on tasks running under cron; their environment can
# only be changed via PAM or from within the crontab; see crontab(5).
READ_ENV="yes"

# Extra options for cron, see cron(8)
#
# For example, to enable LSB name support in /etc/cron.d/, use
# EXTRA_OPTS='-l'
#
# Or, to log standard messages, plus jobs with exit status != 0:
EXTRA_OPTS='-L 5'
#
# For quick reference, the currently available log levels are:
#   0   no logging (errors are logged regardless)
#   1   log start of jobs
#   2   log end of jobs
#   4   log jobs with exit status != 0
#   8   log the process identifier of child process (in all logs)
#
#EXTRA_OPTS=""

Bash:
➜ journalctl -b -g cron
Sep 11 09:18:31 proxmox systemd[1]: Started cron.service - Regular background program processing daemon.
Sep 11 09:18:31 proxmox cron[1614]: (CRON) INFO (pidfile fd = 3)
Sep 11 09:18:31 proxmox cron[1614]: (CRON) INFO (Running @reboot jobs)
Sep 11 09:18:31 proxmox CRON[1617]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Sep 11 09:19:31 proxmox CRON[1617]: pam_unix(cron:session): session closed for user root
Sep 11 10:17:01 proxmox CRON[45479]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Sep 11 10:17:01 proxmox CRON[45480]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Sep 11 10:17:01 proxmox CRON[45481]: (root) CMD (cd / && run-parts --report /etc/cron.hourly)
Sep 11 10:17:01 proxmox CRON[45482]: (root) CMD (root^Icd / && run-parts --report /etc/cron.hourly)
Sep 11 10:17:01 proxmox CRON[45479]: pam_unix(cron:session): session closed for user root
Sep 11 10:17:01 proxmox CRON[45480]: pam_unix(cron:session): session closed for user root
Sep 11 11:17:01 proxmox CRON[78228]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Sep 11 11:17:01 proxmox CRON[78229]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Sep 11 11:17:01 proxmox CRON[78230]: (root) CMD (cd / && run-parts --report /etc/cron.hourly)
Sep 11 11:17:01 proxmox CRON[78231]: (root) CMD (root^Icd / && run-parts --report /etc/cron.hourly)
Sep 11 11:17:01 proxmox CRON[78228]: pam_unix(cron:session): session closed for user root
Sep 11 11:17:01 proxmox CRON[78229]: pam_unix(cron:session): session closed for user root
Sep 11 11:22:14 proxmox systemd[1]: Stopping cron.service - Regular background program processing daemon...
Sep 11 11:22:14 proxmox systemd[1]: cron.service: Deactivated successfully.
Sep 11 11:22:14 proxmox systemd[1]: Stopped cron.service - Regular background program processing daemon.
Sep 11 11:22:14 proxmox systemd[1]: Started cron.service - Regular background program processing daemon.
Sep 11 11:22:14 proxmox cron[84070]: (CRON) INFO (pidfile fd = 3)
Sep 11 11:22:14 proxmox cron[84070]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Sep 11 11:23:42 proxmox systemd[1]: Stopping cron.service - Regular background program processing daemon...
Sep 11 11:23:42 proxmox systemd[1]: cron.service: Deactivated successfully.
Sep 11 11:23:42 proxmox systemd[1]: Stopped cron.service - Regular background program processing daemon.
Sep 11 11:23:42 proxmox systemd[1]: Started cron.service - Regular background program processing daemon.
Sep 11 11:23:42 proxmox cron[86094]: (CRON) INFO (pidfile fd = 3)
Sep 11 11:23:42 proxmox cron[86094]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Sep 11 11:24:01 proxmox cron[86094]: (root) RELOAD (crontabs/root)
Sep 11 11:25:01 proxmox CRON[88939]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Sep 11 11:25:01 proxmox CRON[88939]: pam_unix(cron:session): session closed for user root
Sep 11 11:27:01 proxmox cron[86094]: (root) RELOAD (crontabs/root)
Sep 11 11:27:01 proxmox CRON[93390]: pam_unix(cron:session): session opened for user root(uid=0) by (uid=0)
Sep 11 11:27:01 proxmox CRON[93390]: pam_unix(cron:session): session closed for user root
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get yours easily in our online shop.

Buy now!