Я ищу документацию или прецедент, где в Linux есть каталог со сценариями оболочки, где каждое имя файла приводится с номером, а файлы запускаются в определенном порядке.
Например:
0001-motd.sh
0002-proxy.sh
0300-ssh.sh
Я знаю, что видел это раньше, просто не знаю, где и что он называется.
Я не знаю, либо этот метод / взлома будет работать, либо нет для вашего дела. Но я думаю, что это сработает. Если я прав.
[feddy@localhost ~]$ mkdir test
[feddy@localhost ~]$ cd test
[feddy@localhost test]$ ls
[feddy@localhost test]$ vi 0001-ko.sh
[feddy@localhost test]$ cp 0001-ko.sh 0002-ko.sh
[feddy@localhost test]$ cp 0001-ko.sh 0004-ko.sh
[feddy@localhost test]$ cp 0001-ko.sh 0005-ko file.sh
[feddy@localhost test]$ cp 0001-ko.sh 0008-ko.sh
[feddy@localhost test]$ ls
0001-ko.sh 0002-ko.sh 0004-ko.sh 0005-ko file.sh 0008-ko.sh
[feddy@localhost test]$ for i in *
> do
> bash "$i"
> done
file 0001-ko.sh
file 0002-ko.sh
file 0004-ko.sh
file 0005-ko file.sh
file 0008-ko.sh
[feddy@localhost test]$
ИЛИ
$ find . -iname "*.sh"|while read f; do bash "$f"; done
file ./0001-ko1.sh
file ./0002-ko1.sh
file ./0005-ko1 file.sh
file ./0005-ko1.sh
Вы можете создать скрипт и использовать его для выполнения сценариев в порядке (согласно номера, включенные в имя файла, то есть xxxx-abcdef) в любой папке.
Пожалуйста, исправьте меня, если я ошибаюсь.
Похоже, вы имеете в виду run-parts
NAME
run-parts - run scripts or programs in a directory
SYNOPSIS
run-parts [--test] [--verbose] [--report] [--lsbsysinit] [--regex=RE]
[--umask=umask] [--arg=argument] [--exit-on-error] [--help] [--version]
[--list] [--reverse] [--] DIRECTORY
run-parts -V
DESCRIPTION
run-parts runs all the executable files named within constraints
described below, found in directory directory. Other files and direc‐
tories are silently ignored.
If neither the --lsbsysinit option nor the --regex option is given then
the names must consist entirely of ASCII upper- and lower-case letters,
ASCII digits, ASCII underscores, and ASCII minus-hyphens.
If the --lsbsysinit option is given, then the names must not end in
.dpkg-old or .dpkg-dist or .dpkg-new or .dpkg-tmp, and must belong to
one or more of the following namespaces: the LANANA-assigned namespace
(^[a-z0-9]+$); the LSB hierarchical and reserved namespaces
(^_?([a-z0-9_.]+-)+[a-z0-9]+$); and the Debian cron script namespace
(^[a-zA-Z0-9_-]+$).
If the --regex option is given, the names must match the custom
extended regular expression specified as that option's argument.
Files are run in the lexical sort order (according to the C/POSIX
locale character collation rules) of their names unless the --reverse
option is given, in which case they are run in the opposite order.
Я не знаю, либо этот метод / взлома будет работать, либо нет для вашего дела. Но я думаю, что это сработает. Если я прав.
[feddy@localhost ~]$ mkdir test
[feddy@localhost ~]$ cd test
[feddy@localhost test]$ ls
[feddy@localhost test]$ vi 0001-ko.sh
[feddy@localhost test]$ cp 0001-ko.sh 0002-ko.sh
[feddy@localhost test]$ cp 0001-ko.sh 0004-ko.sh
[feddy@localhost test]$ cp 0001-ko.sh 0005-ko file.sh
[feddy@localhost test]$ cp 0001-ko.sh 0008-ko.sh
[feddy@localhost test]$ ls
0001-ko.sh 0002-ko.sh 0004-ko.sh 0005-ko file.sh 0008-ko.sh
[feddy@localhost test]$ for i in *
> do
> bash "$i"
> done
file 0001-ko.sh
file 0002-ko.sh
file 0004-ko.sh
file 0005-ko file.sh
file 0008-ko.sh
[feddy@localhost test]$
ИЛИ
$ find . -iname "*.sh"|while read f; do bash "$f"; done
file ./0001-ko1.sh
file ./0002-ko1.sh
file ./0005-ko1 file.sh
file ./0005-ko1.sh
Вы можете создать скрипт и использовать его для выполнения сценариев в порядке (согласно номера, включенные в имя файла, то есть xxxx-abcdef) в любой папке.
Пожалуйста, исправьте меня, если я ошибаюсь.
Похоже, вы имеете в виду run-parts
NAME
run-parts - run scripts or programs in a directory
SYNOPSIS
run-parts [--test] [--verbose] [--report] [--lsbsysinit] [--regex=RE]
[--umask=umask] [--arg=argument] [--exit-on-error] [--help] [--version]
[--list] [--reverse] [--] DIRECTORY
run-parts -V
DESCRIPTION
run-parts runs all the executable files named within constraints
described below, found in directory directory. Other files and direc‐
tories are silently ignored.
If neither the --lsbsysinit option nor the --regex option is given then
the names must consist entirely of ASCII upper- and lower-case letters,
ASCII digits, ASCII underscores, and ASCII minus-hyphens.
If the --lsbsysinit option is given, then the names must not end in
.dpkg-old or .dpkg-dist or .dpkg-new or .dpkg-tmp, and must belong to
one or more of the following namespaces: the LANANA-assigned namespace
(^[a-z0-9]+$); the LSB hierarchical and reserved namespaces
(^_?([a-z0-9_.]+-)+[a-z0-9]+$); and the Debian cron script namespace
(^[a-zA-Z0-9_-]+$).
If the --regex option is given, the names must match the custom
extended regular expression specified as that option's argument.
Files are run in the lexical sort order (according to the C/POSIX
locale character collation rules) of their names unless the --reverse
option is given, in which case they are run in the opposite order.