P
P
PaGrom2012-01-26 00:11:07
Python
PaGrom, 2012-01-26 00:11:07

How to add a Python script to autoload?

You need to add the script to autoload. I tried this:
1. chmod +x script.py
2. Moved the script to /etc/init.d/
3. update-rc.d script.py start 99 2 3 4 5. stop 1 0 1 6.
But for some reason it doesn't out. What am I doing wrong?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
S
Sergey Lerg, 2012-01-26
@Lerg

So are links created to it in rc directories?
Maybe they forgot to specify #!/usr/bin/env python at the beginning of the script?
Or does it run but an error occurs in the code?
You can push it into rc.local or add it with defaults instead of exact instructions.

S
stg34, 2012-01-26
@stg34

When my sort of debugged script didn't run from rc.local or from cron, often the problem was
1. $PATH different from the one with which the script was tested
2. Other environment variables may be different, which can lead to inoperability
3. Using relative paths in mcrypt instead of absolute. At the same time, the script does not find the files necessary for work and drops out

L
lorien, 2012-01-26
@lorien

you can just register in cron with @reboot tag

@
@antoo, 2012-01-26
_

create a .sh script with the contents then autoload it
#!/bin/sh
python /path/to/script.py

H
homm, 2012-01-26
@homm

#!/usr/bin/python

V
Vlad Zhivotnev, 2012-01-26
@inkvizitor68sl

In /etc/rc.local a line like:
/usr/bin/python file.py

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question