如何在linux系统中编辑一个脚本,可以自动运行另一个文件夹里的所有脚本? 10
代码echo"USE'aisdb';select*fromt41_ais_historywhere'2013-01-0100:00:00'<timestamp<'2013...
代码echo "USE 'aisdb'; select * from t41_ais_history where '2013-01-01 00:00:00'<timestamp<'2013-01-02 00:00:00' into file '/data3/bydate/tst/20130101.tsv';" | /opt/hypertable/current/bin/ht shell
echo "USE 'aisdb'; select * from t41_ais_history where '2013-01-02 00:00:00'<timestamp<'2013-01-03 00:00:00' into file '/data3/bydate/tst/20130102.tsv';" | /opt/hypertable/current/bin/ht shell
echo "USE 'aisdb'; select * from t41_ais_history where '2013-01-03 00:00:00'<timestamp<'2013-01-04 00:00:00' into file '/data3/bydate/tst/20130103.tsv';" | /opt/hypertable/current/bin/ht shell
echo "USE 'aisdb'; select * from t41_ais_history where '2013-01-04 00:00:00'<timestamp<'2013-01-05 00:00:00' into file '/data3/bydate/tst/20130104.tsv';" | /opt/hypertable/current/bin/ht shell
我需要使这个脚本自动按顺序运行,请问如何运行。 展开
echo "USE 'aisdb'; select * from t41_ais_history where '2013-01-02 00:00:00'<timestamp<'2013-01-03 00:00:00' into file '/data3/bydate/tst/20130102.tsv';" | /opt/hypertable/current/bin/ht shell
echo "USE 'aisdb'; select * from t41_ais_history where '2013-01-03 00:00:00'<timestamp<'2013-01-04 00:00:00' into file '/data3/bydate/tst/20130103.tsv';" | /opt/hypertable/current/bin/ht shell
echo "USE 'aisdb'; select * from t41_ais_history where '2013-01-04 00:00:00'<timestamp<'2013-01-05 00:00:00' into file '/data3/bydate/tst/20130104.tsv';" | /opt/hypertable/current/bin/ht shell
我需要使这个脚本自动按顺序运行,请问如何运行。 展开
展开全部
你写进crontab计划任务就好了,具体操作,百度linux crontab
[root@localhost ~]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
[root@localhost ~]# cat /etc/crontab
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# For details see man 4 crontabs
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed
追问
我想写循环语句,执行好一条之后再执行下一条,怎么样才能实现哪?
追答
照着顺序写就行了
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询