Cron은 내가 작성한 Cron 작업을 실행하지 않습니다. [중복]

Cron은 내가 작성한 Cron 작업을 실행하지 않습니다. [중복]

Cron Job을 작성했지만 실행되지 않았습니다. 왜 실행되지 않는지 아시나요?

내가 실행하고 싶은 Cron 작업은 다음과 같습니다.

#
#
#                   (day of month)                (day of week)
#  min   hou    dom (day of month)    mon     dow (day of week)    command
   *     *      *                     *       *                    /usr/bin/touch /DATA/z_test_$(date '+%Y-%m-%d_T%H-%M').txt >/dev/null 2>&1

매분마다 실행되어야 합니다.
빈 파일을 만들어 /DATA/ 디렉터리에 저장하고 싶습니다.

이것은 내 파일 시스템의 루트입니다.

Tue Apr 11 [srv_data@Ora1 /home/michal]$ ls -lah /
total 28K
dr-xr-xr-x.  18 root     root      236 Apr  3 10:52 .
dr-xr-xr-x.  18 root     root      236 Apr  3 10:52 ..
lrwxrwxrwx.   1 root     root        7 Oct  9  2021 bin -> usr/bin
dr-xr-xr-x.   5 root     root     4.0K Mar 27 11:22 boot
drwxrwx--x.   2 srv_data srv_data 4.0K Apr 11 14:51 DATA
drwxr-xr-x.  18 root     root     3.2K Apr  4 12:20 dev
drwxr-xr-x. 115 root     root     8.0K Apr  5 14:37 etc
drwxr-xr-x.   4 root     root       36 Apr  6 08:58 home
lrwxrwxrwx.   1 root     root        7 Oct  9  2021 lib -> usr/lib
lrwxrwxrwx.   1 root     root        9 Oct  9  2021 lib64 -> usr/lib64
drwxr-xr-x.   2 root     root        6 Oct  9  2021 media
drwxr-xr-x.   2 root     root        6 Oct  9  2021 mnt
drwxr-xr-x.   2 root     root        6 Oct  9  2021 opt
dr-xr-xr-x. 304 root     root        0 Apr  4 12:20 proc
dr-xr-x---.   3 root     root      163 Apr 11 12:04 root
drwxr-xr-x.  39 root     root     1.1K Apr  4 12:20 run
lrwxrwxrwx.   1 root     root        8 Oct  9  2021 sbin -> usr/sbin
drwxr-xr-x.   2 root     root        6 Oct  9  2021 srv
dr-xr-xr-x.  13 root     root        0 Apr  4 12:20 sys
drwxrwxrwt.   6 root     root     4.0K Apr 11 15:14 tmp
drwxr-xr-x.  13 root     root      158 Mar 20 13:08 usr
drwxr-xr-x.  22 root     root     4.0K Mar 28 08:54 var

'srv_data'나는 /DATA/ 디렉터리에 파일을 생성하고 저장할 수 있는 권한이 있는 사용자로 이 Cron 작업을 실행하고 있습니다 .

나는 또한 이 명령을 사용하고 사용자로부터 실행해 보았고 'srv_data'효과가 있었습니다. 내가 예상하는 위치에 파일이 생성됩니다.

Tue Apr 11 [srv_data@Ora1 /home/michal]$ ls -lah /DATA
total 20K
drwxrwx--x.  2 srv_data srv_data 4.0K Apr 11 15:31  .
dr-xr-xr-x. 18 root     root      236 Apr  3 10:52  ..
-rwxrwx--x.  1 srv_data srv_data 1.7K Apr  4 10:14  blade_runner_the_movie_1982
-rw-r--r--.  1 srv_data srv_data  960 Apr 11 15:00  file_with_dates
-rwxrwx--x.  1 srv_data srv_data 2.2K Apr  4 10:09  mud_the_movie_2012
-rw-r--r--.  1 root     root        0 Apr 11 12:43  reczny_plik_01
-rw-r--r--.  1 root     root        0 Apr 11 12:43  reczny_plik_02
-rw-r--r--.  1 root     root        0 Apr 11 12:43  reczny_plik_03
-rw-r--r--.  1 root     root        0 Apr 11 12:43  reczny_plik_04
-rw-r--r--.  1 root     root        0 Apr 11 12:45  reczny_plik_05
-rw-r--r--.  1 root     root        0 Apr 11 12:45  reczny_plik_06
-rw-r--r--.  1 root     root        0 Apr 11 12:45  reczny_plik_07
-rw-r--r--.  1 root     root        0 Apr 11 12:45  reczny_plik_08
-rw-r--r--.  1 root     root        0 Apr 11 12:45  reczny_plik_09
-rwxrwx--x.  1 srv_data srv_data   66 Apr  3 11:18  synch_test_00
-rw-rw-r--.  1 srv_data srv_data    0 Apr  7 15:06  test_2023-04-07_T1506
-rw-rw-r--.  1 srv_data srv_data    0 Apr  7 15:14  test_2023-04-07_T1514
-rw-rw-r--.  1 srv_data srv_data    0 Apr  7 15:17  test_2023-04-07_T1517
-rw-rw-r--.  1 srv_data srv_data    0 Apr  7 15:22  test_2023-04-07_T15-22.txt
-rw-rw-r--.  1 michal   michal      0 Apr 11 14:46  z_test_2023-04-11_T14-46.txt
-rw-rw-r--.  1 michal   michal      0 Apr 11 14:51  z_test_2023-04-11_T14-51.txt
-rw-rw-r--.  1 srv_data srv_data    0 Apr 11 15:31  z_test_2023-04-11_T15-31.txt

이것이 파일의 내용입니다 /var/log/cron.

Apr 11 14:54:01 Ora1 CROND[22557]: (srv_data) CMD (/usr/bin/touch /DATA/z_test_$(date '+)
Apr 11 14:54:01 Ora1 CROND[22559]: (srv_data) CMD (/home/srv_data/sync.sh)
Apr 11 14:54:01 Ora1 CROND[22543]: (srv_data) CMDOUT (/bin/sh: -c: line 0: unexpected EOF while looking for matching `'')
Apr 11 14:54:01 Ora1 CROND[22543]: (srv_data) CMDOUT (/bin/sh: -c: line 1: syntax error: unexpected end of file)
Apr 11 14:54:02 Ora1 CROND[22542]: (srv_data) CMDOUT (sending incremental file list)
Apr 11 14:54:02 Ora1 CROND[22542]: (srv_data) CMDOUT ()
Apr 11 14:54:02 Ora1 CROND[22542]: (srv_data) CMDOUT (sent 602 bytes  received 12 bytes  409.33 bytes/sec)
Apr 11 14:54:02 Ora1 CROND[22542]: (srv_data) CMDOUT (total size is 4,970  speedup is 8.09)
Apr 11 14:55:01 Ora1 CROND[22586]: (srv_data) CMD (/home/srv_data/sync.sh)
Apr 11 14:55:01 Ora1 CROND[22584]: (srv_data) CMD (/usr/bin/touch /DATA/z_test_$(date '+)
Apr 11 14:55:01 Ora1 CROND[22570]: (srv_data) CMDOUT (/bin/sh: -c: line 0: unexpected EOF while looking for matching `'')
Apr 11 14:55:01 Ora1 CROND[22570]: (srv_data) CMDOUT (/bin/sh: -c: line 1: syntax error: unexpected end of file)
Apr 11 14:55:01 Ora1 CROND[22569]: (srv_data) CMDOUT (sending incremental file list)
Apr 11 14:55:01 Ora1 CROND[22569]: (srv_data) CMDOUT ()
Apr 11 14:55:01 Ora1 CROND[22569]: (srv_data) CMDOUT (sent 602 bytes  received 12 bytes  1,228.00 bytes/sec)
Apr 11 14:55:01 Ora1 CROND[22569]: (srv_data) CMDOUT (total size is 4,970  speedup is 8.09)
Apr 11 14:56:01 Ora1 CROND[22611]: (srv_data) CMD (/home/srv_data/sync.sh)
Apr 11 14:56:01 Ora1 CROND[22612]: (srv_data) CMD (/usr/bin/touch /DATA/z_test_$(date '+)
Apr 11 14:56:01 Ora1 CROND[22597]: (srv_data) CMDOUT (/bin/sh: -c: line 0: unexpected EOF while looking for matching `'')
Apr 11 14:56:01 Ora1 CROND[22597]: (srv_data) CMDOUT (/bin/sh: -c: line 1: syntax error: unexpected end of file)
Apr 11 14:56:02 Ora1 CROND[22596]: (srv_data) CMDOUT (sending incremental file list)
Apr 11 14:56:02 Ora1 CROND[22596]: (srv_data) CMDOUT ()
Apr 11 14:56:02 Ora1 CROND[22596]: (srv_data) CMDOUT (sent 602 bytes  received 12 bytes  409.33 bytes/sec)
Apr 11 14:56:02 Ora1 CROND[22596]: (srv_data) CMDOUT (total size is 4,970  speedup is 8.09)
Apr 11 14:57:01 Ora1 CROND[22641]: (srv_data) CMD (/home/srv_data/sync.sh)
Apr 11 14:57:01 Ora1 CROND[22639]: (srv_data) CMD (/usr/bin/touch /DATA/z_test_$(date '+)
Apr 11 14:57:01 Ora1 CROND[22625]: (srv_data) CMDOUT (/bin/sh: -c: line 0: unexpected EOF while looking for matching `'')
Apr 11 14:57:01 Ora1 CROND[22625]: (srv_data) CMDOUT (/bin/sh: -c: line 1: syntax error: unexpected end of file)
Apr 11 14:57:01 Ora1 CROND[22624]: (srv_data) CMDOUT (sending incremental file list)
Apr 11 14:57:01 Ora1 CROND[22624]: (srv_data) CMDOUT ()
Apr 11 14:57:01 Ora1 CROND[22624]: (srv_data) CMDOUT (sent 602 bytes  received 12 bytes  1,228.00 bytes/sec)
Apr 11 14:57:01 Ora1 CROND[22624]: (srv_data) CMDOUT (total size is 4,970  speedup is 8.09)
Apr 11 14:58:01 Ora1 CROND[22670]: (srv_data) CMD (/usr/bin/touch /DATA/z_test_$(date '+)
Apr 11 14:58:01 Ora1 CROND[22669]: (srv_data) CMD (/home/srv_data/sync.sh)
Apr 11 14:58:01 Ora1 CROND[22655]: (srv_data) CMDOUT (/bin/sh: -c: line 0: unexpected EOF while looking for matching `'')
Apr 11 14:58:01 Ora1 CROND[22655]: (srv_data) CMDOUT (/bin/sh: -c: line 1: syntax error: unexpected end of file)
Apr 11 14:58:02 Ora1 CROND[22654]: (srv_data) CMDOUT (sending incremental file list)
Apr 11 14:58:02 Ora1 CROND[22654]: (srv_data) CMDOUT ()
Apr 11 14:58:02 Ora1 CROND[22654]: (srv_data) CMDOUT (sent 602 bytes  received 12 bytes  409.33 bytes/sec)
Apr 11 14:58:02 Ora1 CROND[22654]: (srv_data) CMDOUT (total size is 4,970  speedup is 8.09)
Apr 11 14:59:01 Ora1 CROND[22698]: (srv_data) CMD (/home/srv_data/sync.sh)
Apr 11 14:59:01 Ora1 CROND[22699]: (srv_data) CMD (/usr/bin/touch /DATA/z_test_$(date '+)
Apr 11 14:59:01 Ora1 CROND[22683]: (srv_data) CMDOUT (/bin/sh: -c: line 0: unexpected EOF while looking for matching `'')
Apr 11 14:59:01 Ora1 CROND[22683]: (srv_data) CMDOUT (/bin/sh: -c: line 1: syntax error: unexpected end of file)
Apr 11 14:59:01 Ora1 CROND[22682]: (srv_data) CMDOUT (sending incremental file list)
Apr 11 14:59:01 Ora1 CROND[22682]: (srv_data) CMDOUT ()
Apr 11 14:59:01 Ora1 CROND[22682]: (srv_data) CMDOUT (sent 602 bytes  received 12 bytes  1,228.00 bytes/sec)
Apr 11 14:59:01 Ora1 CROND[22682]: (srv_data) CMDOUT (total size is 4,970  speedup is 8.09)

하지만 이 cron 파일 로그를 읽을 수 없습니다. 나는 그것을 전혀 이해하지 못합니다. 이 파일의 5열에 있는 및 는 무엇입니까 CMD?CMDOUT

무슨 /bin/sh: -c:뜻인가요? ?

관련 정보