I am trying to run my python script while booting. In that time, the script is not working properly. But while run manually, I can see the terminal of script executing. But while run the same script as while boot, I couldn't find the script process. So,I found the tee command, but I don't know how to use this "tee" command in python.
|
closed as off topic by izx, Tachyons, jokerdino♦, ajmitch, fossfreedom♦ Aug 20 '12 at 11:50
Questions on Ask Ubuntu are expected to relate to Ubuntu within the scope defined in the FAQ. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about closed questions here.
|
If the /tmp file system is up when the script is run you can simply open an output file to, say, "/tmp/myscriptoutput" in python and write status to it. I've done that before when looking at upstart jobs. Copy it off before the next boot (when /tmp is wiped out). I suggest using /tmp because that file system should be ready for writing fairly quickly. If your script is running later in the boot process when the root file system is ready for writing you can open the file for writing somewhere else more permanent in that file system. If your desire is to redirect the stdout of your print commands to a file without changing the print commands this answer from our stackoverflow sister site may help. It may be a good idea to redirect stderr as well since you know there may be some kind of error occuring in the script due to the boot environment. The related question may have more information of use to you as well. |
|||
|
|
|
Not sure if this is really what you are looking for, but to run system commands in python, you can do
and run tee that way? |
|||
|
|