LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-08-2016, 02:05 PM   #1
Linutz
LQ Newbie
 
Registered: Aug 2016
Posts: 1

Rep: Reputation: Disabled
Crontab question when running a python program from terminal


So I am trying to use crontab in order to have my python program restart every half hour.

Here are my steps:

env EDITOR=nano crontab -e
*/30 * * * * /users/me/folder/program.py #opens and runs in terminal
#Save
crontab -l #shows that the program is there and it is

So what my questions are:
What will this exactly do to the currently running python program in terminal?
Will it bring up terminal and show me the running python program in terminal and then in 30 minutes exit out and reopen the program again?
When exiting out of the program it asks if i'm sure so will crontab override and still exit out of the are you sure?

Cheers!
 
Old 08-08-2016, 04:49 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,609

Rep: Reputation: 702Reputation: 702Reputation: 702Reputation: 702Reputation: 702Reputation: 702Reputation: 702
Cron runs programs with no console, so you won't get a terminal window unless your python script is creating one and redirecting output to it.

Each invocation of cron is an independent process; there is no connection to any other running program. If your script is already running then there will now be two copies running. You can check with "ps -ef"

If your cron job tries to read console input I think it will get an EOF. You can test what it will do in that case by running in a terminal and typing Ctrl-d at the prompt.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Running a 'python' program on 'Windows" Dafydd Linux - General 4 09-30-2013 09:22 PM
Question about running a program from terminal window ganoo Linux - Newbie 7 11-01-2010 01:44 PM
Program initiated via python's os.system() doesn't work (when in crontab script) itmi Programming 3 03-03-2008 06:36 PM
Running program from terminal with & does nothing, program stops DittoAlex Linux - General 1 10-05-2007 02:35 AM
Python program not running from cron spiri Linux - Software 7 03-09-2006 03:02 AM


All times are GMT -5. The time now is 10:04 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration