I have a clean install of Xubuntu 14.04 32-bit, and anacron doesn't seem to be working.
I read that it's better to use a cron job to trim SSDs, and that Ubuntu has a cron job to do that, so I removed discard from /etc/fstab. I wanted to confirm that the cron job was working, so I added an echo command to /etc/cron.weekly/fstrim so that it looks like this:
#!/bin/sh
# call fstrim-all to trim all mounted file systems which support it
echo "Trim started on" $(date) >> /home/dominic/Desktop/Trim_Runs
set -e
# This only runs on Intel and Samsung SSDs by default, as some SSDs with faulty
# firmware may encounter data loss problems when running fstrim under high I/O
# load (e. g. https://launchpad.net/bugs/1259829). You can append the
# --no-model-check option here to disable the vendor check and run fstrim on
# all SSD drives.
exec fstrim-all
It runs fine from a terminal, but it never runs as a weekly job. So I moved it to cron.daily, but it never runs from there either. So I moved it to cron.hourly, and it does run every hour. The echo text appears in the file, and the drive light comes on for about two minutes. But cron.hourly does not use anacron.
Here is my crontab file. I have changed some of the times, but it didn't seem to work with the original times that came with Xubuntu either.
# /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
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 16 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 1 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 )
#
I tested to see if it would run correctly from my user's crontab by putting the following into crontab -e. Then I waited a few minutes until 8:10 pm, but nothing happened.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
10 20 * * * test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
I think it must have the correct syntax for run-parts, because it does run when I move the script into cron.hourly.
It seems that cron is working but anacron is not. So my question is, what can I do to get anacron working?