| 11 | }}} |
| 12 | |
| 13 | = 遅延実行テスト = |
| 14 | * crontab -l |
| 15 | {{{ |
| 16 | */2 * * * * /home/mitty/crontest |
| 17 | }}} |
| 18 | |
| 19 | == フォアグラウンド sleep == |
| 20 | * /home/mitty/crontest |
| 21 | {{{ |
| 22 | #!/bin/sh |
| 23 | |
| 24 | export LANG=C |
| 25 | |
| 26 | |
| 27 | touch /tmp/$$.`date +%T` |
| 28 | ls -l /tmp |
| 29 | |
| 30 | sleep 60; |
| 31 | |
| 32 | touch /tmp/$$.`date +%T` |
| 33 | ls -l /tmp |
| 34 | }}} |
| 35 | |
| 36 | * pstree -ap |
| 37 | {{{ |
| 38 | ├─cron,662 |
| 39 | │ └─cron,2325 |
| 40 | │ ├─sendmail,2332 -i -FCronDaemon -oem mitty |
| 41 | │ │ └─postdrop,2333 -r |
| 42 | │ └─sh,2326 -c /home/mitty/crontest |
| 43 | │ └─crontest,2327 /home/mitty/crontest |
| 44 | │ └─sleep,2331 60 |
| 45 | }}} |
| 46 | |
| 47 | * mail |
| 48 | {{{ |
| 49 | Mail version 8.1.2 01/15/2001. Type ? for help. |
| 50 | "/var/mail/mitty": 1 message 1 new |
| 51 | >N 1 root@lucid.mitty. Tue May 18 16:07 25/937 Cron <mitty@lucid> /home/mi |
| 52 | & |
| 53 | Message 1: |
| 54 | From mitty@lucid.mitty.jp Tue May 18 16:07:01 2010 |
| 55 | X-Original-To: mitty |
| 56 | From: root@lucid.mitty.jp (Cron Daemon) |
| 57 | To: mitty@lucid.mitty.jp |
| 58 | Subject: Cron <mitty@lucid> /home/mitty/crontest |
| 59 | Content-Type: text/plain; charset=ANSI_X3.4-1968 |
| 60 | X-Cron-Env: <SHELL=/bin/sh> |
| 61 | X-Cron-Env: <HOME=/home/mitty> |
| 62 | X-Cron-Env: <PATH=/usr/bin:/bin> |
| 63 | X-Cron-Env: <LOGNAME=mitty> |
| 64 | Date: Tue, 18 May 2010 16:06:01 +0900 (JST) |
| 65 | |
| 66 | total 0 |
| 67 | -rw-r--r-- 1 mitty mitty 0 May 18 16:06 2327.16:06:01 |
| 68 | drwx------ 2 mitty mitty 22 May 18 13:51 ssh-qAiiolp854 |
| 69 | total 0 |
| 70 | -rw-r--r-- 1 mitty mitty 0 May 18 16:06 2327.16:06:01 |
| 71 | -rw-r--r-- 1 mitty mitty 0 May 18 16:07 2327.16:07:01 |
| 72 | drwx------ 2 mitty mitty 22 May 18 13:51 ssh-qAiiolp854 |
| 73 | }}} |
| 74 | |
| 75 | === with mail command === |
| 76 | * /home/mitty/crontest |
| 77 | {{{ |
| 78 | #!/bin/sh |
| 79 | |
| 80 | export LANG=C |
| 81 | |
| 82 | |
| 83 | touch /tmp/$$.`date +%T` |
| 84 | ls -l /tmp 2>&1 | mail $LOGNAME |
| 85 | |
| 86 | sleep 60; |
| 87 | |
| 88 | touch /tmp/$$.`date +%T` |
| 89 | ls -l /tmp 2>&1 | mail $LOGNAME |
| 90 | }}} |
| 91 | |
| 92 | * pstree -ap |
| 93 | {{{ |
| 94 | ├─cron,662 |
| 95 | │ └─cron,2647 |
| 96 | │ └─sh,2649 -c /home/mitty/crontest |
| 97 | │ └─crontest,2650 /home/mitty/crontest |
| 98 | │ └─sleep,2658 60 |
| 99 | }}} |
| 100 | |
| 101 | * mail |
| 102 | {{{ |
| 103 | Mail version 8.1.2 01/15/2001. Type ? for help. |
| 104 | "/var/mail/mitty": 2 messages 2 new |
| 105 | >N 1 mitty@lucid.mitty Tue May 18 16:30 15/540 |
| 106 | N 2 mitty@lucid.mitty Tue May 18 16:31 16/595 |
| 107 | & |
| 108 | Message 1: |
| 109 | From mitty@lucid.mitty.jp Tue May 18 16:30:01 2010 |
| 110 | X-Original-To: mitty |
| 111 | To: mitty@lucid.mitty.jp |
| 112 | Date: Tue, 18 May 2010 16:30:01 +0900 (JST) |
| 113 | From: mitty@lucid.mitty.jp (mitty) |
| 114 | |
| 115 | total 0 |
| 116 | -rw-r--r-- 1 mitty mitty 0 May 18 16:30 2650.16:30:01 |
| 117 | drwx------ 2 mitty mitty 22 May 18 13:51 ssh-qAiiolp854 |
| 118 | |
| 119 | & |
| 120 | Message 2: |
| 121 | From mitty@lucid.mitty.jp Tue May 18 16:31:02 2010 |
| 122 | X-Original-To: mitty |
| 123 | To: mitty@lucid.mitty.jp |
| 124 | Date: Tue, 18 May 2010 16:31:01 +0900 (JST) |
| 125 | From: mitty@lucid.mitty.jp (mitty) |
| 126 | |
| 127 | total 0 |
| 128 | -rw-r--r-- 1 mitty mitty 0 May 18 16:30 2650.16:30:01 |
| 129 | -rw-r--r-- 1 mitty mitty 0 May 18 16:31 2650.16:31:01 |
| 130 | drwx------ 2 mitty mitty 22 May 18 13:51 ssh-qAiiolp854 |
| 131 | }}} |
| 132 | |
| 133 | |
| 134 | |
| 135 | == バックグラウンド sleep == |
| 136 | * /home/mitty/crontest |
| 137 | {{{ |
| 138 | #!/bin/sh |
| 139 | |
| 140 | export LANG=C |
| 141 | |
| 142 | |
| 143 | touch /tmp/cron.$$.`date +%T.%N` |
| 144 | ls -l /tmp |
| 145 | |
| 146 | sleep 60 & |
| 147 | |
| 148 | touch /tmp/cron.$$.`date +%T.%N` |
| 149 | ls -l /tmp |
| 150 | }}} |
| 151 | |
| 152 | * pstree -ap |
| 153 | {{{ |
| 154 | ├─cron,662 |
| 155 | │ └─cron,2948 |
| 156 | │ ├─sendmail,2955 -i -FCronDaemon -oem mitty |
| 157 | │ │ └─postdrop,2959 -r |
| 158 | │ └─(sh,2950) |
| 159 | |
| 160 | ├─sleep,2956 60 |
| 161 | }}} |
| 162 | |
| 163 | * mail |
| 164 | {{{ |
| 165 | Mail version 8.1.2 01/15/2001. Type ? for help. |
| 166 | "/var/mail/mitty": 1 message 1 new |
| 167 | >N 1 root@lucid.mitty. Tue May 18 16:53 25/982 Cron <mitty@lucid> /home/mi |
| 168 | & |
| 169 | Message 1: |
| 170 | From mitty@lucid.mitty.jp Tue May 18 16:53:02 2010 |
| 171 | X-Original-To: mitty |
| 172 | From: root@lucid.mitty.jp (Cron Daemon) |
| 173 | To: mitty@lucid.mitty.jp |
| 174 | Subject: Cron <mitty@lucid> /home/mitty/crontest |
| 175 | Content-Type: text/plain; charset=ANSI_X3.4-1968 |
| 176 | X-Cron-Env: <SHELL=/bin/sh> |
| 177 | X-Cron-Env: <HOME=/home/mitty> |
| 178 | X-Cron-Env: <PATH=/usr/bin:/bin> |
| 179 | X-Cron-Env: <LOGNAME=mitty> |
| 180 | Date: Tue, 18 May 2010 16:52:02 +0900 (JST) |
| 181 | |
| 182 | total 0 |
| 183 | -rw-r--r-- 1 mitty mitty 0 May 18 16:52 cron.2951.16:52:01.997709994 |
| 184 | drwx------ 2 mitty mitty 22 May 18 13:51 ssh-qAiiolp854 |
| 185 | total 0 |
| 186 | -rw-r--r-- 1 mitty mitty 0 May 18 16:52 cron.2951.16:52:01.997709994 |
| 187 | -rw-r--r-- 1 mitty mitty 0 May 18 16:52 cron.2951.16:52:02.013689211 |
| 188 | drwx------ 2 mitty mitty 22 May 18 13:51 ssh-qAiiolp854 |
| 189 | }}} |
| 190 | |
| 191 | === with mail command === |
| 192 | * /home/mitty/crontest |
| 193 | {{{ |
| 194 | #!/bin/sh |
| 195 | |
| 196 | export LANG=C |
| 197 | |
| 198 | |
| 199 | touch /tmp/cron.$$.`date +%T.%N` |
| 200 | ls -l /tmp 2>&1 | mail $LOGNAME |
| 201 | |
| 202 | sleep 60 & |
| 203 | |
| 204 | touch /tmp/cron.$$.`date +%T.%N` |
| 205 | ls -l /tmp 2>&1 | mail $LOGNAME |
| 206 | }}} |
| 207 | |
| 208 | * pstree -ap |
| 209 | {{{ |
| 210 | ├─cron,662 |
| 211 | │ └─cron,3006 |
| 212 | │ └─(sh,3008) |
| 213 | |
| 214 | ├─sleep,3017 60 |
| 215 | }}} |
| 216 | |
| 217 | * mail |
| 218 | {{{ |
| 219 | Mail version 8.1.2 01/15/2001. Type ? for help. |
| 220 | "/var/mail/mitty": 2 messages 2 new |
| 221 | >N 1 mitty@lucid.mitty Tue May 18 16:56 15/555 |
| 222 | N 2 mitty@lucid.mitty Tue May 18 16:56 16/625 |
| 223 | & |
| 224 | Message 1: |
| 225 | From mitty@lucid.mitty.jp Tue May 18 16:56:01 2010 |
| 226 | X-Original-To: mitty |
| 227 | To: mitty@lucid.mitty.jp |
| 228 | Date: Tue, 18 May 2010 16:56:01 +0900 (JST) |
| 229 | From: mitty@lucid.mitty.jp (mitty) |
| 230 | |
| 231 | total 0 |
| 232 | -rw-r--r-- 1 mitty mitty 0 May 18 16:56 cron.3009.16:56:01.044354156 |
| 233 | drwx------ 2 mitty mitty 22 May 18 13:51 ssh-qAiiolp854 |
| 234 | |
| 235 | & |
| 236 | Message 2: |
| 237 | From mitty@lucid.mitty.jp Tue May 18 16:56:01 2010 |
| 238 | X-Original-To: mitty |
| 239 | To: mitty@lucid.mitty.jp |
| 240 | Date: Tue, 18 May 2010 16:56:01 +0900 (JST) |
| 241 | From: mitty@lucid.mitty.jp (mitty) |
| 242 | |
| 243 | total 0 |
| 244 | -rw-r--r-- 1 mitty mitty 0 May 18 16:56 cron.3009.16:56:01.044354156 |
| 245 | -rw-r--r-- 1 mitty mitty 0 May 18 16:56 cron.3009.16:56:01.089449007 |
| 246 | drwx------ 2 mitty mitty 22 May 18 13:51 ssh-qAiiolp854 |
| 247 | }}} |
| 248 | |
| 249 | === >/dev/null 2>&1 & === |
| 250 | * /home/mitty/crontest |
| 251 | {{{ |
| 252 | #!/bin/sh |
| 253 | |
| 254 | export LANG=C |
| 255 | |
| 256 | |
| 257 | touch /tmp/cron.$$.`date +%T.%N` |
| 258 | ls -l /tmp 2>&1 | mail $LOGNAME |
| 259 | |
| 260 | sleep 60 >/dev/null 2>&1 & |
| 261 | |
| 262 | touch /tmp/cron.$$.`date +%T.%N` |
| 263 | ls -l /tmp 2>&1 | mail $LOGNAME |
| 264 | }}} |
| 265 | |
| 266 | * pstree -ap |
| 267 | {{{ |
| 268 | ├─cron,662 |
| 269 | |
| 270 | ├─sleep,3083 60 |
| 271 | }}} |
| 272 | |
| 273 | mail |
| 274 | {{{ |
| 275 | Mail version 8.1.2 01/15/2001. Type ? for help. |
| 276 | "/var/mail/mitty": 2 messages 2 new |
| 277 | >N 1 mitty@lucid.mitty Tue May 18 17:00 15/555 |
| 278 | N 2 mitty@lucid.mitty Tue May 18 17:00 16/625 |
| 279 | & |
| 280 | Message 1: |
| 281 | From mitty@lucid.mitty.jp Tue May 18 17:00:01 2010 |
| 282 | X-Original-To: mitty |
| 283 | To: mitty@lucid.mitty.jp |
| 284 | Date: Tue, 18 May 2010 17:00:01 +0900 (JST) |
| 285 | From: mitty@lucid.mitty.jp (mitty) |
| 286 | |
| 287 | total 0 |
| 288 | -rw-r--r-- 1 mitty mitty 0 May 18 17:00 cron.3075.17:00:01.108414369 |
| 289 | drwx------ 2 mitty mitty 22 May 18 13:51 ssh-qAiiolp854 |
| 290 | |
| 291 | & |
| 292 | Message 2: |
| 293 | From mitty@lucid.mitty.jp Tue May 18 17:00:01 2010 |
| 294 | X-Original-To: mitty |
| 295 | To: mitty@lucid.mitty.jp |
| 296 | Date: Tue, 18 May 2010 17:00:01 +0900 (JST) |
| 297 | From: mitty@lucid.mitty.jp (mitty) |
| 298 | |
| 299 | total 0 |
| 300 | -rw-r--r-- 1 mitty mitty 0 May 18 17:00 cron.3075.17:00:01.108414369 |
| 301 | -rw-r--r-- 1 mitty mitty 0 May 18 17:00 cron.3075.17:00:01.161439061 |
| 302 | drwx------ 2 mitty mitty 22 May 18 13:51 ssh-qAiiolp854 |