Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 ? – Gilles Quenot 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. – Gilles Quenot Jul 11 '12 at 14:06

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .