LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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,197

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
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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



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

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:43 PM.

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
Open Source Consulting | Domain Registration