Enable crond for scheduled actions

OuTTaRiCe
Posts: 4
Joined: Sat Jan 24, 2015 11:52 am

Enable crond for scheduled actions

Postby OuTTaRiCe » Sat Jan 24, 2015 12:17 pm

The following steps will enable crond to allow scheduled automation of your devices directly from the wink hub.

1.) Set your timezone. The Wink HUB defaults to UTC, you may want to set this to your local timezone.

Edit /etc/profile and add the following to the file. This example sets Eastern timezone with auto adjust DST.

Code: Select all

TZ='EST5EDT'
export TZ


2.) Create the startup script to startup crond on boot up.

This start script will mkdir the cron directory, copy a custom crontab file from the /database and start /usr/sbin/crond.

create file /etc/init.d/S62cron

Code: Select all

#!/bin/sh

case "${1}" in
   start)
      echo -n "Starting crond..."
      mkdir -p /var/spool/cron/crontabs
      cp /database/crontab.root /var/spool/cron/crontabs/root
      /usr/sbin/crond
      ;;

   stop)
      echo -n "Stopping crond..."
      killall crond
      ;;

   restart)
      ${0} stop
      sleep 1
      ${0} start
      ;;

   *)
      echo "Usage: $0 [start|stop|restart]"
      ;;
esac


Make sure to set permission of the file.

Code: Select all

chmod 755 /etc/init.d/S62cron


3.) Sample /database/crontab.root file.

This example will turn my light on 100% at 6pm, Dim the light at 11pm (as a nightlight), Turns off light at 5am.

Code: Select all

00 18 * * * /usr/sbin/aprontest -m1 -t2 -u -v255;/usr/sbin/aprontest -m1 -t1 -u -vON
00 23 * * * /usr/sbin/aprontest -m1 -t2 -u -v1
00 05 * * * /usr/sbin/aprontest -m1 -t1 -u -vOFF


4.) Start the crond and you are good to go.

Code: Select all

/etc/init.d/S62cron start

Return to “Root a new out of the box Wink”

Who is online

Users browsing this forum: No registered users and 1 guest