Linux Crontab: Cron jobs by example

Linux Crontab Format

Minutes Hour DayOfMonth Month DayOfWeek Command
Field Allowed Values
Minutes 0 to 59
Hour 0 to 23
Day of Month 1-31
Month 1-12
Day Of Week 0-6
Command Command to be run

Example 1

Run a job at 5 minutes past 3am every day

5 3 * * * /scripts/

Example 2

Run a job at 8am minutes and 7pm every day

0 8,19 * * * /scripts/

Cassandra DBA – Tricks and tips

Change replication factor for an existing keyspace

ALTER KEYSPACE acme WITH REPLICATION =  { 'class' : 'SimpleStrategy', 'replication_factor' : 2 };

Drop a keyspace


Drop a column

ALTER TABLE person DROP mail;

Add a column

ALTER TABLE person ADD email text;

Counting keys (rows) in column. Here is a quick way to get an “estimated” count

nodetool cfstats acme.person

Command to check cluster / node status

nodetool status

Force restart of datastax agent

service datastax-agent force-reload

How to insert current date-time into a table using CQL?

This can be done using the now and dateof functions.

The now function takes no arguments and generates a new unique timeuuid (at the time where the statement using it is executed).

The dateof function takes a timeuuid argument and extracts the embedded timestamp.

INSERT INTO account (name, created) VALUES ('acme', dateof(now()));