Issue
I have 2 commands I want to run one after another and would like to create a script and add it to cron. My commands are:
wget http://browscap.org/stream?q=Full_PHP_BrowsCapINI -O /etc/php/7.2/mods-available/browscap.ini
service php7.2-fpm restart
Is it possible to have it download the file, wait till it completes then run the restart script?
Solution
To run the second command after your wget download completes, separate the two commands with the double ampersand &&
As a one-liner:
wget http://browscap.org/stream?q=Full_PHP_BrowsCapINI -O /etc/php/7.2/mods-available/browscap.ini && service php7.2-fpm restart
The command after the double ampersand &&
should only run if the first command (the wget download) successfully completes.
Answered By - pcamach2 Answer Checked By - Senaida (WPSolving Volunteer)