Linux
-
创建/etc/init.d/cassandra 启动脚本。
-
编辑文件的内容:
#!/bin/sh # # chkconfig: - 80 45 # description: Starts and stops Cassandra # update daemon path to point to the cassandra executable DAEMON=<Cassandra installed directory>/bin/cassandra start() { echo -n "Starting Cassandra... " $DAEMON -p /var/run/cassandra.pid echo "OK" return 0 } stop() { echo -n "Stopping Cassandra... " kill $(cat /var/run/cassandra.pid) echo "OK" return 0 } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) echo $"Usage: $0 {start|stop|restart}" exit 1 esac exit $?
-
使文件可执行:
sudo chmod + x /etc/init.d/cassandra
-
将新服务添加到列表中:
sudo chkconfig –add cassandra
-
现在,你可以从命令行管理服务:
sudo /etc/init.d/cassandra start sudo /etc/init.d/cassandra stop sudo /etc/init.d/cassandra restart