2

I've been learning Python for a project required for work. We are starting up a new server that will be running linux, and need a python script to run that will monitor a folder and handle files when they are placed in the folder.

I have the python "app" working, but I'm having a hard time finding how to make this script run when the server is started. I know it's something simple, but my linux knowledge falls short here.

Secondary question: As I understand it I don't need to compile or install this application, basically just call the start script to run it. Is that correct?

1
  • Depends on your Linux, but this is what init/upstart/systemd can do, or, more simply put a script in the runlevel directory Commented Oct 14, 2016 at 0:25

1 Answer 1

2

You can set up the script to run via cron, configuring time as @reboot

With python scripts, you will not need to compile it. You might need to install it, depending on what assumptions your script makes about its environment.

Sign up to request clarification or add additional context in comments.

4 Comments

To add some complexity, I actually have two that I need to run. The second is more complex and consists of multiple python files and is more like an application. Can you point me to some info on what I might need to do to install this?
Wow! A suprising and elegant solution!
@Jhorra check the docs and examples provided Actually you can have any number of crontab entries, running at any time
@Jhorra most of the times it is fairly straightforward - make an application directory, and run the main python script right out of there, e.g. cd foo && python bar.py

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.