I have been racking my brain on a problem with my cron. Any insight will be appreciated
Senario Pi user
1. Create a cron entry with nano
Code: Select all
crontab -e
Code: Select all
no crontab for pi - using an empty one
/tmp/crontab.B8LA9a: Permission denied
Creation of temporary crontab file failed - aborting
Code: Select all
drwxr-xr-x 3 root root 4.0K Oct 11 14:07 cron
Code: Select all
drwx-wx--T 2 root crontab 4.0K Oct 11 14:07 crontabs
Senario root user
1. Create a cron entry with nano
Code: Select all
crontab -e
Code: Select all
# Edit this file to introduce tasks to be run by cron.
#
# Each task to run has to be defined through a single line
# indicating with different fields when the task will be run
# and what command to run for the task
#
# To define the time you can provide concrete values for
# minute (m), hour (h), day of month (dom), month (mon),
# and day of week (dow) or use '*' in these fields (for 'any').#
# Notice that tasks will be started based on the cron's system
# daemon's notion of time and timezones.
#
# Output of the crontab jobs (including errors) is sent through
# email to the user the crontab file belongs to (unless redirected).
#
# For example, you can run a backup of all your user accounts
# at 5 a.m every week with:
# 0 5 * * 1 tar -zcf /var/backups/home.tgz /home/
#
# For more information see the manual pages of crontab(5) and cron(8)
#
# m h dom mon dow command
Code: Select all
# HELLO WORLD
@reboot echo "Hello World" > /var/log/reboot.txt 2>&1
Code: Select all
no crontab for root - using an empty one
crontab: installing new crontab
6. cat /var/spool/cron/crontabs/root shows the file is intact
7. Reboot RPi3
8. /var/spool/cron/crontabs/root IS GONE!. There is no cron file for root
9. list the root user crontab
Code: Select all
crontab -l
no crontab for root
cron file for root (/var/spool/cron/crontabs/root) gets deleted sometime before or after rebooting
Searching for Solutions
There is nothing in /var/log/ when I
Code: Select all
cat /var/log/syslog | grep cron
cat /var/log/boot.log | grep cron
systemctl status cron.service
Code: Select all
● cron.service - Regular background program processing daemon
Loaded: loaded (/lib/systemd/system/cron.service; enabled)
Active: active (running) since Tue 2016-10-11 14:49:44 EDT; 3min 21s ago
Docs: man:cron(8)
Main PID: 322 (cron)
CGroup: /system.slice/cron.service
└─322 /usr/sbin/cron -f
Oct 11 14:49:44 systemd[1]: Starting Regular background program processing daemon...
Oct 11 14:49:44 systemd[1]: Started Regular background program processing daemon.
Oct 11 14:49:44 cron[322]: (CRON) INFO (pidfile fd = 3)
Oct 11 14:49:44 cron[322]: /var/spool/cron: No such file or directory
Oct 11 14:49:44 cron[322]: /var/spool/cron: created
Oct 11 14:49:44 cron[322]: crontabs: No such file or directory
Oct 11 14:49:44 cron[322]: crontabs: created
Oct 11 14:49:44 cron[322]: crontabs: chowned
Oct 11 14:49:44 cron[322]: (CRON) INFO (Running @reboot jobs)
cat /etc/default/cron
Code: Select all
# 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=""
1. Tried uninstalling and reinstalling (not fixed)
Possible solution
1. Edit the /etc/crontab. It doesn't seem to get deleted
Please help.