cron - how to properly run Python script with crontab on every system startup -


i have python script should open linux terminal, browser, file manager , text editor on system startup. decided crontab suitable way automatically run script. unfortunately, doesn't went well, nothing happened when reboot laptop. so, captured output of script file in order clues. seems script partially executed. use debian 8 (jessie), , here's python script:

#!/usr/bin/env python3  import subprocess import webbrowser  def action():     subprocess.call('gnome-terminal')     subprocess.call('subl')     subprocess.call(('xdg-open', '/home/fin/documents/learning'))     webbrowser.open('https://reddit.com/r/python')  if __name__ == '__main__':     action() 

here's entry in crontab file:

@reboot python3 /home/fin/labs/my-cheatcodes/src/dsktp_startup_script/dsktp_startup_script.py > capture_report.txt 

here's content of capture_report.txt file (i trim several lines, since long, prints folder structures. seems came 'xdg-open' line on python script):

directory list of /home/fin/documents/learning/                      type       format     sort                    [tree    ] [standard] [by name] [update] ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ /   ... rest of dir stuctures goes here 

i have no other clue what's possible going wrong here. appreciate advice guys. thanks.

no, cron not suitable this. cron daemon has no connection user's desktop session, not running @ system startup, anyway.

my recommendation hook desktop environment's login scripts, responsible starting various desktop services when log in, anyway, , extended own scripts.


Comments

  1. Wow, I really liked this blog!! You described the true struggles of the developer. When I was in Delhi, I could not find a worthwhile referral client who looked for an expert Website developer in Delhi to collaborate as freelancing. Then I switched to work as a freelancer full time at EIliana.com. The things are really impressive here, and I love how they work.

    ReplyDelete

Post a Comment

Popular posts from this blog

serialization - Convert Any type in scala to Array[Byte] and back -

matplotlib support failed in PyCharm on OSX -

python - Matplotlib: TypeError: 'AxesSubplot' object is not callable -