Ubuntu Forums Archive Viewer

redirect output boot script

Archived thread 2057045 from Ubuntu Application Development. Markdown source: Ubuntu_Application_Development/thread_2057045_redirect_output_boot_script.md

Original URL About this archive
#1

hy, i have a python script. It works. example:


#!/usr/bin/env python
print "hello world"

i have put this script in the startup applications (system -> preference -> startup application)

i don't know if this script work at the boot. there is a way to redirect the output in a file?

This is my /home/user/.config/autostart/script.desktop file:


[Desktop Entry]
Type=Application
Exec=python /home/user/.scrscript/.script.py &> /home/user/log.txt
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[it_IT]=example
Name=example
Comment[it_IT]=python 
Comment=python 
#2
Exec=python /home/user/.scrscript/.script.py > /home/user/log.txt 2>&1 &
#3

This doesn't work for me (12.04)

[Desktop Entry]
Type=Application
Exec=firefox file:///opt/peace/index.html?datamode=7 > /var/log/peace/firefox.log 2>&1 &
Hidden=false
NoDisplay=false
X-GNOME-Autostart-enabled=true
Name[en_NZ]=firefox
Name=firefox
Comment[en_NZ]=
Comment=
ls -l /var/log

...
drwxrwxrwx 2 usr1              usr1    4096 Apr 20 20:27 peace
...

I tried with and without trailing ampersand (which is assumed anyway as it's startup apps are backgrounded tasks)

Any thoughts?

Thanks

#4

Anybody got any thoughts?

#5

Well, firefox writing nothing on standard output when starting up is normal. What are you trying to log?

#6

I use window.dump from firefox and it outputs fine when run directly from a shell. Fair point, but I do expect valid output from firefox in this instance. Thanks

#7

Still unresolved. Any further advice?