rouiniho
Posts: 4
Joined: Wed Feb 26, 2014 9:11 pm

make a python script run automatically

Wed Apr 09, 2014 11:55 pm

hello , i have a socket code writed with python ...

---------------------------------------------------------------------------------------------------------------------------------------------------------------------
import socket
Sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
Host = '192.168.42.1'
Port = 5000

Sock.bind((Host,Port))

Sock.listen(1)

client, adresse = Sock.accept()
print "L'adresse",adresse,"vient de se connecter au serveur !"
while 1:
RequeteDuClient = client.recv(255)
if not RequeteDuClient:
break
print RequeteDuClient,"\a"


------------------------------------------------------------------------------------------------------------------------------------------------------

this code work with python server.py .

but i want to make it work automatically in boot of the card ...

gammaradiation999
Posts: 2
Joined: Wed Apr 09, 2014 9:35 pm

Re: make a python script run automatically

Thu Apr 10, 2014 11:02 am

Perhaps this works:

This allows you to edit your cron:

Code: Select all

crontab -e 
Then add line like this to it:

Code: Select all

@reboot /path/to/script
That should execute the script always when the raspberry boots

Return to “Troubleshooting”