#!/bin/bash

source /service/sbin/setup

if [ $1 == "init" ]; then 
    /service/sbin/init01.sh
elif [ $1 == "halt" ]; then 
    /service/sbin/halt01.sh    
elif [ $1 == "hosts" ]; then 
    pophosts
elif [ $1 == "start" ]; then 
    su ferry -c 'nohup /service/bin/cassandra &'
    sleep 2
elif [ $1 == "restart" ]; then 
    su ferry -c 'nohup /service/bin/cassandra &'
    sleep 2
elif [ $1 == "stop" ]; then 
    # Stop the Cassandra daemon.
    pkill -f CassandraDaemon

    # Killing the ssh daemon should automatically exit the container,
    # since the sshd is the only thing running in the foreground. 
fi
