Top
Systemwalker Operation Manager  Reference Guide
FUJITSU Software

4.22 chkfile / jobschchkfile Command

The chkfile / jobschchkfile command checks the existence of a file, and waits for the file to be created/updated/deleted/resized.

Synopsis

[Windows]

chkfile [-fwait [-sw]] [-fdelete [-sd]] [-fsize|-fupdate] [-i <monitoring interval>] [-a] drive:file name

chkfile [-wait|-update[-d:yyyymmdd][-t:hhmm]|-delete] [-i <monitoring interval>] {drive:file name|-file:drive:list file name [-AND|-OR]}

chkfile [-z] drive:file name

[UNIX]

jobschchkfile [-fwait [-sw]] [-fdelete [-sd]] [-fsize|-fupdate] [-i <monitoring interval>] file name

jobschchkfile [-wait|-update[-d:yyyymmdd] [-t:hhmm]|-delete] [-i <monitoring interval>] {file name|-file: list file name [-AND|-OR]}

jobschchkfile [-z] file name

Options

-fwait

If the file does not exist, the command waits for it to be created. Nothing is returned if the file exists when the command starts. If the file is confirmed as having been deleted, a value is returned once the file is recreated.

You can combine this option with -fdelete, -fupdate, and -fsize to make the command wait. In this case, a value is returned when any of the conditions is satisfied.

-sw

Specify this option together with -fwait.

If you specify this option and the file exists when the command starts, a value is returned immediately.

-fdelete

If the file exists, the command waits for the file to be deleted. If the file does not exist when the command starts, nothing is returned. If the file is confirmed as having been created, a value is returned once the file is again deleted.

You can combine this option with -fwait, -fupdate, and -fsize to make the command wait. In this case, a value is returned when any of the conditions is satisfied.

-sd

Specify this option together with -fdelete.

If you specify this option and the file does not exist when the command starts, a value is returned immediately.

-fupdate

If the file exists, the command waits for the update date to be changed. If the file does not exist when the command starts, nothing is returned even if the file is created. If the file is confirmed as having been created, a value is returned once the update date is subsequently confirmed as having been changed.

You can combine this option with -fwait and -fdelete to make the command wait. In this case, a value is returned when any of the conditions is satisfied. You cannot combine this option with -fsize.

-fsize

The command waits for the file size to be changed. Nothing is returned if the file is created or deleted. If the file is updated but there is no change in size, nothing is returned. To make the command wait for the file to be updated without any change in size, use -fupdate.

You can combine this option with -fwait and -fdelete to make the command wait. In this case, a value is returned when any of the conditions is satisfied. You cannot combine this option with -fupdate.

-wait

If the file does not exist, the command waits for it to be created. If the file exists when the command starts, a value is returned immediately.

You cannot combine this option with -delete, -update, -fwait, -fdelete, -fupdate, or -fsize to make the command wait.

-delete

If the file exists, the command waits for the file to be deleted. If the file does not exist when the command starts, a value is returned immediately.

You cannot combine this option with -wait, -update, -fwait, -fdelete, -fupdate, or -fsize to make the command wait.

-update

If the file does not exist, the command waits for it to be created.

If the file exists, the command waits for the update date to be changed.

You cannot combine this option with -wait, -delete, -fwait, -fdelete, -fupdate, or -fsize to make the command wait.

-d:yyyymmdd

Specify this option together with -update.

Specify the reference date to be used to determine if the file was updated.

For example, for June 5 2014, specify -d:20140605.

If this option is omitted, the current date or later is assumed.

-t:hhmm

Specify this option together with -update.

Specify the reference time to be used to determine if the file was updated.

For example, for 13:35, specify -t:1335.

If this option is omitted, the current time or later is assumed.

-i interval

Specify the interval at which the status of the file will be checked, from 1 to 3600 seconds. If this option is omitted, the file status is checked at intervals of 1 second.

-a [Windows]

Use this option together with -fwait, -fupdate, or -fsize.

If the file status is checked, this command waits for access to the target file from other programs to cease. For example, if you specify -fwait to make the command wait for the file to be created and another program is creating (accessing) the file, the command does not terminate. If the file has been created when the status is checked after the next monitoring interval and other programs have ceased accessing the file, the command terminates.

-z

Checks the existence of the file. If the file does not exist, the command will terminate with return value 0. If you check the existence of the file without specifying this option and the file exists, the command will terminate with return value 0.

drive:file name [Windows]

Specify the full path name of the target file.

If none of the options -fwait, -fdelete, -fupdate, -fsize, -wait, -delete, or -update is set, specify the name of the file whose existence is to be checked.

You can specify the wildcard character "*" for all or part of the file name when you specify -fwait, -fdelete, -fupdate, or -fsize. Wildcard characters can be used only for the file name. They cannot be used to specify the drive name or directory name.

file name [UNIX]

Specify the full path name of the target file.

If none of the options -fwait, -fdelete, -fupdate, -fsize, -wait, -delete, or -update is set, specify the name of the file whose existence is to be checked.

You can specify the wildcard character "*" for all or part of the file name when you specify -fwait, -fdelete, -fupdate, or -fsize. But since the wildcard character "*" has a special meaning for the shell script, it must be escaped with a backslash (\). Wildcard characters can be used only for the file name. They cannot be used to specify the directory name.

-file:drive:list file name [Windows]

Use this option together with -wait, -delete, or -update.

Specify the name of a file (list file) that defines the target files.

If none of the options -wait, -delete, or -update is set, specify the name of the file that defines the files whose existence is to be checked.

You can list multiple file names in a list file.

You cannot specify wildcard characters in the list file name. Wildcard characters also cannot be specified in the file names defined in the list file.

-file:list file name [UNIX]

Use this option together with -wait, -delete, or -update.

Specify the name of a file (list file) that defines the target files.

If none of the options -wait, -delete, or -update is set, specify the name of the file that defines the files whose existence is to be checked.

You can list multiple file names in a list file.

You cannot specify wildcard characters in the list file name. Wildcard characters also cannot be specified in the file names defined in the list file.

-AND|OR

If a list file name is specified with the -file option, specify whether to target all files within the list file or to target a specific file.

If this option is omitted, the command targets all files within the list file. The following describes the behavior of the -wait, -delete, and -update options.

Return Values

Return value

Meaning

0

The file was created/updated/deleted.

Alternatively, the -z option was not specified and the file exists.

Alternatively, the -z option was specified and the file does not exist.

1

The -z option was not specified and the file does not exist.

Alternatively, the -z option was specified and the file exists.

10

An internal error occurred.

Command Location

Windows

Systemwalker Operation Manager installation directory\MpWalker.JM\bin

Solaris
HP-UX
AIX
Linux

/usr/bin

Example 1

Example 2

Example of waiting for all files (c:\a.txt, d:\b.txt, d:\c.txt) defined in d:\temp\list_file to be updated at or after 13:30 on December 5, 2014 [Windows]

chkfile -update -d:20141205 -t:1330 -file:d:\temp\list_file -AND

[Example of d:\temp\list_file]

c:\a.txt
d:\b.txt
d:\c.txt

Example of waiting for all files (/home/a.dat, /home/b.dat, /home/c.dat) defined in /var/tmp/list_file to be updated at or after 13:30 on December 5, 2014 [UNIX]

jobschchkfile -update -d:20141205 -t:1330 -file:/var/tmp/list_file -AND

[Example of /var/tmp/list_file]

/home/a.dat
/home/b.dat
/home/c.dat

Information

Registering commands as jobs

To automatically start job nets when a file is created/updated/deleted/resized, schedule the chkfile and jobschchkfile commands as jobs. By registering a command as the first job in a job net, you can make later processes wait for a file to be created/updated/deleted/resized.

Execution Result/Output Format

Cautions