19,612
社区成员
发帖
与我相关
我的任务
分享
*/3 * * * * /tmp/cp_file.sh
*/5 * * * * /tmp/aiFileTrans -c /tmp/aiFileTrans.xml
Jul 6 08:57:01 37f8bbce7b38 CROND[718]: (root) CMD (/tmp/cp_file.sh)
Jul 6 09:00:01 37f8bbce7b38 CROND[723]: (root) CMD (/tmp/aiFileTrans -c /tmp/aiFileTrans.xml)
Jul 6 09:00:01 37f8bbce7b38 CROND[724]: (root) CMD (/tmp/cp_file.sh)
Jul 6 09:01:01 37f8bbce7b38 CROND[731]: (root) CMD (run-parts /etc/cron.hourly)
Jul 6 09:01:01 37f8bbce7b38 run-parts(/etc/cron.hourly)[731]: starting 0anacron
Jul 6 09:01:01 37f8bbce7b38 anacron[740]: Anacron started on 2017-07-06
Jul 6 09:01:01 37f8bbce7b38 anacron[740]: Will run job `cron.daily' in 6 min.
Jul 6 09:01:01 37f8bbce7b38 anacron[740]: Will run job `cron.weekly' in 26 min.
Jul 6 09:01:01 37f8bbce7b38 anacron[740]: Will run job `cron.monthly' in 46 min.
Jul 6 09:01:01 37f8bbce7b38 anacron[740]: Jobs will be executed sequentially
Jul 6 09:01:01 37f8bbce7b38 run-parts(/etc/cron.hourly)[742]: finished 0anacron
Jul 6 09:03:01 37f8bbce7b38 CROND[745]: (root) CMD (/tmp/cp_file.sh)
Jul 6 09:05:01 37f8bbce7b38 CROND[748]: (root) CMD (/tmp/aiFileTrans -c /tmp/aiFileTrans.xml)
Jul 6 09:06:01 37f8bbce7b38 CROND[757]: (root) CMD (/tmp/cp_file.sh)
Jul 6 09:07:01 37f8bbce7b38 anacron[740]: Job `cron.daily' started
Jul 6 09:07:01 37f8bbce7b38 run-parts(/etc/cron.daily)[759]: starting logrotate
Jul 6 09:07:01 37f8bbce7b38 run-parts(/etc/cron.daily)[767]: finished logrotate
Jul 6 09:07:01 37f8bbce7b38 anacron[740]: Job `cron.daily' terminated
Jul 6 09:09:01 37f8bbce7b38 CROND[769]: (root) CMD (/tmp/cp_file.sh)
2017-07-06 15:15:43 <LL_INFO> ************* aiFileTrans log *************
2017-07-06 15:15:43 <LL_INFO> parsing xml file complete, the config info:
2017-07-06 15:15:43 <LL_INFO> log_path:./aiFileTrans.log
2017-07-06 15:15:43 <LL_INFO> log_level:5
2017-07-06 15:15:43 <LL_INFO> src_path:./testDir
2017-07-06 15:15:43 <LL_INFO> access_dest_path:./aDir
2017-07-06 15:15:43 <LL_INFO> bss_dest_path:./bDir
2017-07-06 15:15:43 <LL_INFO> bak_path:./bakDir
2017-07-06 15:15:43 <LL_INFO> db_user_name:root
2017-07-06 15:15:43 <LL_INFO> db_user_pwd:123456
2017-07-06 15:15:43 <LL_INFO> db_database_name:docker
2017-07-06 15:15:43 <LL_INFO> db_database_ip:172.18.0.2
2017-07-06 15:15:43 <LL_INFO> db_database_port:3306
2017-07-06 15:15:43 <LL_INFO> parsing xml file success.
2017-07-06 15:15:43 <LL_INFO> database connection is OK.
2017-07-06 15:15:43 <LL_INFO> source path:./testDir, accessPath:./aDir, bss/detail Path:./bDir, bakPath:./bakDir
2017-07-06 15:15:43 <LL_INFO> folder:aDir created.
2017-07-06 15:15:43 <LL_INFO> folder:bDir created.
2017-07-06 15:15:43 <LL_INFO> folder:bakDir created.
2017-07-06 15:15:43 <LL_INFO> folder:bakDir/temp created.
2017-07-06 15:15:43 <LL_INFO> ./testDir/d_201708171733_234523.dat(1 line, size:0MB) processed and moved
2017-07-06 15:15:43 <LL_INFO> total cost time38.996201ms.
2017-07-06 16:29:05 <LL_INFO> ************* aiFileTrans log *************
2017-07-06 16:29:05 <LL_INFO> parsing xml file complete, the config info:
2017-07-06 16:29:05 <LL_INFO> log_path:./aiFileTrans.log
2017-07-06 16:29:05 <LL_INFO> log_level:5
2017-07-06 16:29:05 <LL_INFO> src_path:./testDir
2017-07-06 16:29:05 <LL_INFO> access_dest_path:./aDir
2017-07-06 16:29:05 <LL_INFO> bss_dest_path:./bDir
2017-07-06 16:29:05 <LL_INFO> bak_path:./bakDir
2017-07-06 16:29:05 <LL_INFO> db_user_name:root
2017-07-06 16:29:05 <LL_INFO> db_user_pwd:123456
2017-07-06 16:29:05 <LL_INFO> db_database_name:docker
2017-07-06 16:29:05 <LL_INFO> db_database_ip:172.18.0.2
2017-07-06 16:29:05 <LL_INFO> db_database_port:3306
2017-07-06 16:29:05 <LL_INFO> parsing xml file success.
2017-07-06 16:29:05 <LL_INFO> database connection is OK.
2017-07-06 16:29:05 <LL_INFO> source path:./testDir, accessPath:./aDir, bss/detail Path:./bDir, bakPath:./bakDir
2017-07-06 16:29:05 <LL_INFO> ./testDir/d_201708171733_234523.dat(1 line, size:0MB) processed and moved
2017-07-06 16:29:05 <LL_INFO> total cost time59.900293ms.
!/bin/bash
. /etc/profile
. ~/.bash_profile
/tmp/aiFileTrans -c /tmp/aiFileTrans.xml
还是不运行第二个crontab任务,请大神指点,先谢谢了
*/2 * * * * /tmp/aiFileTrans -c /tmp/aiFileTrans.xml >/root/1.txt 2>&1
/root/1.txt 的内容(报错信息)为:
/tmp/aiFileTrans: /tmp/aiFileTrans: cannot execute binary file
之后我把第二行(第二个任务)写到cp_file3.sh里面,加了运行权限:
*/2 * * * * sh -x /tmp/cp_file3.sh >/root/1.txt 2>&1
/root/1.txt 的内容(报错信息)为(每行加上了编号):
1 + '!/bin/bash'
2 /tmp/cp_file3.sh: line 1: !/bin/bash: No such file or directory
3 + . /etc/profile
4 ++ '[' -x /usr/bin/id ']'
5 ++ '[' -z 0 ']'
6 +++ /usr/bin/id -un
7 ++ USER=root
8 ++ LOGNAME=root
9 ++ MAIL=/var/spool/mail/root
10 ++ '[' 0 = 0 ']'
11 ++ pathmunge /sbin
12 ++ case ":${PATH}:" in
13 ++ '[' '' = after ']'
14 ++ PATH=/sbin:/usr/bin:/bin
15 ++ pathmunge /usr/sbin
16 ++ case ":${PATH}:" in
17 ++ '[' '' = after ']'
18 ++ PATH=/usr/sbin:/sbin:/usr/bin:/bin
19 ++ pathmunge /usr/local/sbin
20 ++ case ":${PATH}:" in
21 ++ '[' '' = after ']'
22 ++ PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/bin:/bin
23 +++ /bin/hostname
24 ++ HOSTNAME=37f8bbce7b38
25 ++ HISTSIZE=1000
26 ++ '[' '' = ignorespace ']'
27 ++ export HISTCONTROL=ignoredups
28 ++ HISTCONTROL=ignoredups
29 ++ export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL
30 ++ '[' 0 -gt 199 ']'
31 ++ umask 022
32 ++ for i in '/etc/profile.d/*.sh'
33 ++ '[' -r /etc/profile.d/colorls.sh ']'
34 ++ '[' hxB '!=' hxB ']'
35 ++ . /etc/profile.d/colorls.sh
36 ++ for i in '/etc/profile.d/*.sh'
37 ++ '[' -r /etc/profile.d/glib2.sh ']'
38 ++ '[' hxB '!=' hxB ']'
39 ++ . /etc/profile.d/glib2.sh
40 ++ for i in '/etc/profile.d/*.sh'
41 ++ '[' -r /etc/profile.d/lang.sh ']'
42 ++ '[' hxB '!=' hxB ']'
43 ++ . /etc/profile.d/lang.sh
44 ++ for i in '/etc/profile.d/*.sh'
45 ++ '[' -r /etc/profile.d/less.sh ']'
46 ++ '[' hxB '!=' hxB ']'
47 ++ . /etc/profile.d/less.sh
48 ++ unset i
49 ++ unset -f pathmunge
50 + . /root/.bash_profile
51 ++ '[' -f /root/.bashrc ']'
52 ++ . /root/.bashrc
53 +++ alias 'rm=rm -i'
54 +++ alias 'cp=cp -i'
55 +++ alias 'mv=mv -i'
56 +++ '[' -f /etc/bashrc ']'
57 +++ . /etc/bashrc
58 ++++ '[' '' ']'
59 ++++ shopt -q login_shell
60 ++++ '[' 0 -gt 199 ']'
61 ++++ umask 022
62 ++++ for i in '/etc/profile.d/*.sh'
63 ++++ '[' -r /etc/profile.d/colorls.sh ']'
64 ++++ '[' '' ']'
65 ++++ . /etc/profile.d/colorls.sh
66 ++++ for i in '/etc/profile.d/*.sh'
67 ++++ '[' -r /etc/profile.d/glib2.sh ']'
68 ++++ '[' '' ']'
69 ++++ . /etc/profile.d/glib2.sh
70 ++++ for i in '/etc/profile.d/*.sh'
71 ++++ '[' -r /etc/profile.d/lang.sh ']'
72 ++++ '[' '' ']'
73 ++++ . /etc/profile.d/lang.sh
74 ++++ for i in '/etc/profile.d/*.sh'
75 ++++ '[' -r /etc/profile.d/less.sh ']'
76 ++++ '[' '' ']'
77 ++++ . /etc/profile.d/less.sh
78 ++++ unset i
79 ++++ unset pathmunge
80 ++ PATH=/usr/local/sbin:/usr/sbin:/sbin:/usr/bin:/bin:/root/bin
81 ++ export PATH
82 + /tmp/aiFileTrans -c /tmp/aiFileTrans.xml