The short answer is make each script exit with 1 for success or 0 on error and then
But that isn't really the best solution. I would either combine the four scripts into one script or put the functionality into a module. The first solution looks likedo '1-search_user.pl' or die; do '2-prepare_2update_user.pl' or die; do '3-backup.pl' or die; do '4-run_update.pl' or die;
Are these scripts used elsewhere? If so then I'd go for a module and the script would then look like.search_user(); prepare_2update_user(); backup(); run_update(); sub search_user { ... } etc
In either case each function throws it's own exception so you don't check for errors if all you want to do is exit.use MyModule; MyModule::search_user(); MyModule::prepare_2update_user(); MyModule::backup(); MyModule::run_update();
To get started with modules see Simple Module Tutorial
The script executes sequentially and it can be run from cron, you will need to ensure that it can find the other scripts, environment variables may not be set so do '/path/to/script' or push @INC, '/path/to' may be necessary.
In reply to Re: Executing multiple scripts sequentially
by hipowls
in thread Executing multiple scripts sequentially
by fabster01
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |