dyluck Posted July 13, 2010 Share Posted July 13, 2010 Hi There, I have a question. I have a few scripts that are specifically designed to be run from shell for the purpose of Cron. I want to be able to write 1 php script to run as a CRON JOB that executes these other shell level php scripts on a daily basis? Thanks Link to comment https://forums.phpfreaks.com/topic/207646-php-mysql-and-shell/ Share on other sites More sharing options...
AbraCadaver Posted July 13, 2010 Share Posted July 13, 2010 Use an include in your 1 script to include the others. This can be as simple as just including each, or reading all files in a directory and including them, etc... Link to comment https://forums.phpfreaks.com/topic/207646-php-mysql-and-shell/#findComment-1085532 Share on other sites More sharing options...
dyluck Posted July 13, 2010 Author Share Posted July 13, 2010 you see the problem is, the php files that are to be executed in shell have commands like this php daily_cronfile.php specificID i.e. php daily_cronfile.php blaa1 so how do I execute that in a php file? something like: shell_exec('php daily_cronfile.php blaa1') command within the main php file? Link to comment https://forums.phpfreaks.com/topic/207646-php-mysql-and-shell/#findComment-1085543 Share on other sites More sharing options...
AbraCadaver Posted July 13, 2010 Share Posted July 13, 2010 you see the problem is, the php files that are to be executed in shell have commands like this php daily_cronfile.php specificID i.e. php daily_cronfile.php blaa1 so how do I execute that in a php file? something like: shell_exec('php daily_cronfile.php blaa1') command within the main php file? Yes, exec() or shell_exec() will work. Link to comment https://forums.phpfreaks.com/topic/207646-php-mysql-and-shell/#findComment-1085545 Share on other sites More sharing options...
dyluck Posted July 13, 2010 Author Share Posted July 13, 2010 thanks I found some examples on PHP.net Link to comment https://forums.phpfreaks.com/topic/207646-php-mysql-and-shell/#findComment-1085546 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.