Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I've a python server wich I want to start at boot. This server is listening to a specific port for input.

I've created a new cronjob crontab -e

@reboot /path/to/script

Put the script in /etc/init.d and created sybmbolic links to it.

The script runs fine when I use /path/to/script the script runs fine.

share|improve this question
    
Is there any subprocess in your python script, like running a shell command ? –  sputnick Jul 11 '12 at 13:53
    
It connects to a mysql db –  OrangeTux Jul 11 '12 at 13:58
    
Wouldn't it just be simpler to copy-paste an existing init.d file and replace the all the junk with ways to start your script? (hell, you only really need the 'start' and 'stop' option in an init.d script). That way you can set it to boot up automagically and forget about it. –  qweet Jul 11 '12 at 13:59
    
Is it connects with python lib or executable ? I think something is different in your environment cron -> interactive. –  sputnick Jul 11 '12 at 14:06
add comment

1 Answer

Put inside your init script

source ~/.bashrc || source /etc/profile

I guess the environment is different in crontab and in interactive session.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.