LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 10-01-2007, 10:12 AM   #1
sebell
LQ Newbie
 
Registered: Oct 2007
Posts: 2

Rep: Reputation: 0
Running process from cron with PTTY


Folks,

Is there a way to run a command from cron allocating
a pseudo-terminal? I have a closed application that
performs TTY checking, and although the application
doesn't require interaction, this checking process
prevents running it from cron.

- Scott
 
Old 10-02-2007, 07:53 PM   #2
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,189

Rep: Reputation: 105Reputation: 105
You could try screen. It is typically used to create a ptty terminal session that can be detached and reconnected later for long running processes. You could create a cron script that runs screen and then runs the app inside that session. You should get a ptty when the app tests.

http://www.gnu.org/software/screen/
 
Old 10-03-2007, 06:36 AM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,289

Rep: Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034Reputation: 2034
How about calling it from 'expect'; a tool that fakes tty env so you can automate 'manual' programs.
See eg http://linux.maruhn.com/sec/expect.html
 
Old 10-03-2007, 07:57 AM   #4
sebell
LQ Newbie
 
Registered: Oct 2007
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for the reply guys!

Both are good solutions, but since I don't have
`expect' handy (and I don't need it's excellent
interactive feature-set) I went with screen.

This is much better than the hand-written hack
I had in place using forkpty(3).

- Scott
 
  


Reply

Tags
script, server


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
cron process - info kshkid Programming 7 03-14-2006 01:42 PM
CRON Process Won't Execute Automatically Transition Linux - General 5 01-14-2005 03:51 PM
What is ptty baggz Debian 3 12-10-2004 08:30 PM
Cron not running Half_Elf Linux - Software 4 01-10-2003 02:38 AM
cron job to restart process if dead gborrageiro Linux - General 3 09-25-2002 11:55 AM


All times are GMT -5. The time now is 07:39 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration