ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
I'm currently making a bash script to untar and configure apache, mysql php4 and a few other programs, but i'm having trouble with the script and need to be able to find where the errors are.
But the problem is so much output information comes up on the screen and i can only move up a few screens lengths, is there some code i can put into the script that create a log file from the screen output.
Thanks for the replies everyone, macemoneta solution worked like a treat. I'll try the others as well, print a copy of this page to have as a reference, which will come in hand since i've Just started learning PHP programming.
theYinYeti, exec 1>/path/to/logfile 2>&1
I take it this goes at the very top of the script.
Oops sorry! I overlooked the "PHP" aspect of your first post
What I wrote only applies to shell (bash at least) scripts, not PHP. Other solutions do apply to any scripts however, because they happen in the bash side of things even if the script itself is PHP.
No you were right the first time, the script i'm working on is for a bash script. At college we are lerning how to install Apache, Mysql and PHP4 on one machine, and the other machine already has a webserver running were we upload are webpages and test a PHP scripts.
I just wanted to make a script to help with the installation process since it will be part of the practical test coming up in a few weeks. And since php can run linux console commands, I thought these would be a nice addition
i am running the script and a cron to take the backup every day at some time.
i like to create logfile automatically all the time when cron runs and logfile name shpuld contain the date so we can easily locate it.
and also like to write into output of terminal (about backup process) into newly created log file