LINUX shell 编写 定时启动
程序员文章站
2022-06-30 10:51:33
...
在根目录创建 RestartTSDB.sh
内容如下:
service opentsdb stop
su - hbase <<EOF
/usr/hbase/hbase-1.2.4/bin/stop-hbase.sh;
echo "********";
/usr/hbase/hadoop-2.6.5/sbin/stop-yarn.sh;
echo "********";
/usr/hbase/hadoop-2.6.5/sbin/stop-dfs.sh;
echo "********";
/usr/hbase/hadoop-2.6.5/sbin/start-dfs.sh;
echo "********";
/usr/hbase/hadoop-2.6.5/sbin/start-yarn.sh;
echo "********";
/usr/hbase/hbase-1.2.4/bin/start-hbase.sh;
echo "********";
exit;
EOF
service opentsdb start
编写定时器 var/spool/cron/root
文件名称 root
* * * * * echo "test" >> /tmp/test.file
0 3 * * * /root/RestartTSDB.sh