(Video materials in preparation)
semwait : Wait until the specified file exists
Usage : semwait [option..] <path1> <path2> ..
Options : -a
-o
--less_than <n>
--more_than <n>
-s <sec>
-t <time>
--interval <ms>
Version : Mon Jan 22 09:17:08 JST 2024
Edition : 1
If all specified files (path1 path2 ...) exist, the command exits
normally. If at least one of the files doesn't exist, the command
waits. The command checks for the files every one second. You can
use wildcards (* ? []) in path names.
You can specify the deadline timestamp using the -t option in one
of the four formats below:
HHMM:HourMinute
HHMMSS:HourMinuteSecond
YYYYMMDDHHMM:YearMonthDayHourMinute
YYYYMMDDHHMMSS:YearMonthDayHourMinuteSecond
If the deadline timestamp is passed, the command exits with an error.
You can specify the maximum number of seconds to wait using the -s
option. When <sec> of seconds has passed since executing the
command, it exits with an error. You can specify after the decimal
point for <sec> to denote subsecond.
If the --interval option is speified, interval time is changed to
<ms> milliseconds.
The -a options is the default. It causes the command to wait for
ALL files to exist.
If the -o option is specified, the command exits when any one of
the files exists.
Wait until 16:30 for sem1 and sem2 to exist
(An error occurs at 16:30:01)
$ semwait -t 1630 sem1 sem2 || exit 1
Wait at most 5 seconds for sem1 and sem2 to exist
$ semwait -s 5 sem1 sem2 || exit 1
Change interval time to 100 ms for sem1 and sem2 to exist
$ semwait --interval 100 sem1 sem2
Wait until either sem1 or sem2 exists
$ semwait -o sem1 sem2
Wait at most 10 seconds for any file starting with 'sem.' to exist
$ semwait -s 10 'sem.*'
Wait at most 10 secinds for there to be less than three
files starting with 'sem.'
$ semwait -s 10 --less_than 3 'sem.*'
Wait at most 10 secinds for there to be more than three
files starting with 'sem.'
$ semwait -s 10 --more_than 3 'sem.*'