I am trying to run a python script at ubuntu startup.
The script(play.py
) plays a youtube video in chrome browser.
import webbrowser
import time
import subprocess as sp
val = 0;
while(val <1):
time.sleep(1)
#webbrowser.open("https://www.youtube.com/watch?v=dO1rMeYnOmM")
child = sp.Popen("google-chrome %s" % "https://www.youtube.com/watch?v=dO1rMeYnOmM", shell=True)
val = val +1
To run this script at ubuntu startup I added the following entry in rc.local
:
python /home/user_name/Desktop/python/play.py &
And changes the mode of play.py
to 777
.
I also tried copying this script file to /etc/init.d
.
But still the script does not execute at system startup.