What is the best way to monitor a directory on webserver and automatically create following directories if something happens.
e.g
A dir_1 gets created in monitored_dir. Auto creation of dir_1-1, dir_1-2, ... in dir_1.
What is the best way to monitor a directory on webserver and automatically create following directories if something happens.
e.g
A dir_1 gets created in monitored_dir. Auto creation of dir_1-1, dir_1-2, ... in dir_1.
Don't know exactly what you want to do, but think like this?
#!/bin/bash
NUMBER=0
DIR=/srv/monitored_dir/dir_1/
if [[ ! -d "${DIR}" ]]; then
while [[ $NUMBER -lt 4 ]]; do
mkdir "${DIR}"-dir_1-"${NUMBER}"
NUMBER=$["${NUMBER}"+1]
done
fi