I'm currently using a bash script with a lot of "same" lines.
cd /home/admin/web/mysite1.com/public_html/admin/; /usr/bin/php cron.php &
cd /home/admin/web/mysite2.com/public_html/admin/; /usr/bin/php cron.php &
cd /home/admin/web/mysite3.com/public_html/admin/; /usr/bin/php cron.php &
cd /home/admin/web/mysite4.com/public_html/admin/; /usr/bin/php cron.php &
I would like to know if it's possible to execute a command like this
/usr/bin/find /home/admin/web/*/public_html/admin/ -name 'cron.php' php cron.php
Thanks
CodePudding user response:
You can do it with a simple for loop
for i in /home/admin/web/*/public_html/admin/cron.php; do
/usr/bin/php "$i" &
done
See also this question for good answers: Bash Script - iterating over output of find