Cronjob doesn't work

Hey Community,

does somebody has an idea why my cronjob doesn’t work as user volumio?
I already changed deactivated the “killall-9 cron” in sudo nano /var/www/command/orion_optimize.sh.

...
if [ "$2" == "startup" ]; then
## kill useless system processes
#killall -9 avahi-daemon
#killall -9 dbus-daemon
#deaktiviert exim4, ntp, 
#killall -9 exim4
#killall -9 ntpd
#killall -9 rpc.idmapd
#killall -9 rpc.statd
#killall -9 rpcbind
killall -9 thd
#killall -9 udevd
#killall -9 automount
#killall -9 cron
killall -9 atd
#killall -9 dhclient
killall -9 startpar
#Automatic unmuting
sh /home/volumio/unmute.sh
echo "flush startup settings"
fi
...

The volumio crontab -e looks like this: (it does not work without the SHELL and PATH Command too)

SHELL=/bin/bash
PATH=/usr/local/bin:/usr/local/sbin:/sbin:/usr/sbin:/bin:/usr/bin:/usr/bin/X11

# Update MPC Database/ Musiktitel
0 9 * * * mpc update
0 1 * * * sh /home/volumio/RadioOneUpdate.sh
#
#Muster
#58 21 * * 4 streamripper http://typhoon.exequo.org:8000/rinseradio -q -a -A -d /mnt/USB/89_streamripper/rinse_hessleaudio
#
#Test
42 23 * * 1 /usr/bin/streamripper http://bbcmedia.ic.llnwd.net/stream/bbcmedia_radio1_mf_p -A -a /mnt/USB/00_neu/test02-$(date "+%Y_%m_%d").mp3
43 23 * * 1 /usr/bin/killall streamripper
#

My root crontab -e does work pretty well:

@reboot ntpdate -s 0.de.pool.ntp.org
0 */3 * * * ntpdate -s 0.de.pool.ntp.org
59 23 * * * rm -r /mnt/USB/99_bis24uhr/*

Does somebody has an idea what I forgot? What’s about the Right-Management of cron started by volumio?

Regards
dafosy

You could check if cron is running with “/etc/init.d/cron status” and with cron -l you should see the current cron scripts for the current user.
Does cron report any errors?

Hello.

No there is no error running cron. Even the /usr/sbin/cron -l tells me, that the Permission is denied for opening /var/run/crond.pid. If I try it with sudo than the message is: “Ressource temporarily unavailable”

It is maybe a bash and sh problem. I made a redirect with the same code to a skript for bash. And now it works.

UPDATE for VERSION: 0.979 : 20-08-2016

Hi! Thanks in advance for your help!

the NEW version seems to have insert some CHANGES in the new version, that BREAK cron.

Main points:

  • cron.service is still NOT installed by default; it can be installed with apt-get easily
  • cron is NOT killed anymore by /var/www/command/orion_optimize.sh. After installation and reboot, it can be found running
  • cron jobs are not run
  • the DIRECTORY /var/www/ has been REMOVED (!!) and so the “old” orion_optimize.sh… (btw… where is now the www dir ??)

I have installed cron, edited the crontab of volumio@volumio, and reboot…
cron IS running, but something prevents him to run the crontab…

Any help or idea, to solve the PROBLEM in the NEW version problem ?

Report:

CRON is running

volumio@volumio:~$ /etc/init.d/cron status ● cron.service - Regular background program processing daemon Loaded: loaded (/lib/systemd/system/cron.service; enabled) Active: active (running) since Wed 2016-09-28 11:17:24 UTC; 6h ago Docs: man:cron(8) Main PID: 565 (cron) CGroup: /system.slice/cron.service └─565 /usr/sbin/cron -f

CRONTAB created

[code]volumio@volumio:~$ crontab -l

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

Update MPC Database/ Musiktitel

0 9 * * * mpc update

Minute Hour Day of Month Month Day of Week Command

(0-59) (0-23) (1-31) (1-12 or Jan-Dec) (0-6 or Sun-Sat)

25        8           *             *                2-6            /home/volumio/playradio.sh
20       130          *             *                2-6            /home/volumio/pauseradio.sh
25        15          *             *                2-6            /home/volumio/playradio.sh
40        19          *             *                2-6            /home/volumio/pauseradio.sh 

[/code]

SCRIPTS are working

volumio@volumio:~$ ./playradio.sh ABCLounge: Andrea Cardillo - Desert Mirage [playing] #1/1 165:26/0:00 (0%) volume: n/a repeat: off random: off single: off consume: off

FILES list

volumio@volumio:~$ ls -al total 37 drwxr-xr-x 1 volumio volumio 4096 Sep 24 17:53 . drwxr-xr-x 1 root root 4096 Aug 20 16:38 .. -rw------- 1 volumio volumio 655 Sep 27 06:43 .bash_history -rw-r--r-- 1 volumio volumio 220 Oct 18 2014 .bash_logout -rw-r--r-- 1 volumio volumio 3515 Oct 18 2014 .bashrc drwx------ 3 volumio volumio 4096 Sep 24 08:43 .cache drwx------ 3 volumio volumio 4096 Sep 24 08:43 .config drwx------ 3 volumio volumio 4096 Sep 24 08:43 .local -rw-r--r-- 1 volumio volumio 675 Oct 18 2014 .profile -rw-r--r-- 1 volumio volumio 0 Sep 24 08:38 .selected_editor -rwxr-xr-x 1 volumio volumio 22 Sep 24 17:51 pauseradio.sh -rwxr-xr-x 1 volumio volumio 21 Sep 24 17:50 playradio.sh

SOLVED

The problem appear to be the timezone of volumio, not corresponding with the actual location, giving an incorrect date/time.

It seems that there is NO raspi-config command NOR raspiconfig package to fix time zone (can someone confirm that ??)

The solution is to:
REMOVE the actual localtime
LINK the correct one

rm /etc/localtime ln -s /usr/share/zoneinfo/Europe/Rome /etc/localtime

BR

I am having the same issue, but seemingly worse.

System Version 2.0001.

volumio@volumio:~$ /etc/init.d/cron status
-bash: /etc/init.d/cron: No such file or directory

volumio@volumio:~$ apt-get install cron

Package cron is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

any ideas? any one else got the issue?

Ok, I spoke too soon. Just needed to:

sudo apt-get update

then install cron as described above!