2

I have a while loop in my Python Script and its independent script so I can't run it as a daemon.

Also I have tryed using nohup, but I'm having this error:

root@ubuntu:~/Desktop/starthere-group-ok# nohup python yApp.py &
[1] 3038
root@ubuntu:~/Desktop/starthere-group-ok# nohup: ignoring input and appending output to `nohup.out'

The nohup.out:

1) Deployment
2) Service Status
3) List Servers
4) Restart Service
5) Restart Server
6) Execute Commands on Servers
Seçiminizi yapın: Traceback (most recent call last):
  File "yApp.py", line 13, in <module>
    selection = raw_input("Seçiminizi yapın: ")
IOError: [Errno 9] Bad file descriptor

My script is kind of a job, I mean the Deployment part. It takes hours and hours sometimes and I can't leave the PuTTy open.

Seçiminizi yapın:
Means "Make your selection" in Turkish.

Maybe thats why I'm having this error? I'm using;

#!/usr/bin/env python
# -*- coding: utf-8 -*-

Metas at the beginning.

So, what should I do?

Thanks in advance.

MrCskncn
  • 23
  • 5

1 Answers1

3

You can use screen to keep your session alive

http://www.rackaid.com/resources/linux-screen-tutorial-and-how-to/

Or you could submit the job with "at"

http://linux.about.com/library/cmd/blcmdl1_at.htm

ckliborn
  • 2,778
  • 4
  • 25
  • 37
  • Screen works fine, but i'm making this script for someone else and i dont think he can use it. Is there a code embedded way of doing it? with screen or not? Also "at" command is not for me. – MrCskncn Dec 12 '11 at 22:38
  • 1
    And I have found the way of doing it by screen. `if selection: exe = Plugin.getAttribute('execute') system('screen python '+exe)` Also benefits of using like this: Killing the screen after job completes. – MrCskncn Dec 12 '11 at 22:44