Raspberry Pi and Cron

After two days of attempting to get Cron to execute tasks (in this case shell scripts) on a Raspberry PI, I finally got it working.

I must have read at least three dozen sites and all my Raspberry Pi books in my attempts, nothing work..

Here are some of the suggestions I found.

This one states it will edit the users cron file:

pi@raspberry ~ $ crontab -e

This one states it will display all the users schedule cron tasks:

pi@raspberry ~ $ crontab -l

I did find these useful:

pi@raspberry ~ $ /etc/init.d/cron stop

pi@raspberry ~ $ /etc/init.d/cron start

pi@raspberry ~ $  /etc/init.d/cron restart

But none triggered my script to run, then in my notes, from a past project I found:

pi@raspberry ~ $  sudo nano /etc/crontab 

This allowed me to edit the system cron task list..

———————————————–

# /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 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts –repo$

47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts –repo$

52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts –repo$

10 * * * * pi cd /home/pi && ./jabberfix.sh

#

———————————————–

The last task, which runs at 10 minutes after the hour, for user pi, fixes my jabber connection.

Honestly, I have no clue what the other tasks are doing. More research! But I am very happy I now know how to add my own tasks to cron.

Enjoy

~David

 

 

PlexConnect Update

Opps Sorry.

Figured this out the solution a while ago, didn’t posted as promised.

The solution to the PlexConnect, connecting to my existing Plex Server, was. Is it WOULD NOT work. Plex has to be running on the same box as PlexConnect. And you can’t run PlexConnect on a SERVER because the server already uses the ports that PlexConnect wants to use.  Solution, install both on another box, then connect the new Plex system to the existing Plex server. Yes, it is messy, but it worked.

We still have the problem when the power goes out, that someone manually has to start PlexConnect. But we still have plans to create a small LiveCode program that will handle that. So keep checking back.

~David