standard input and cron


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting standard input and cron
# 1  
Old 08-14-2011
standard input and cron

I have a program that requires the user to enter input values while it is being run
for example in bash
Code:
...
...
..
echo "Enter your input"
read input
echo $input
...
...
...

I need to schedule this program with crontab, hence a problem, cronjobs run in the background, any ideas on how to make the cronjob ask for human input while executing the script?

Last edited by zxmaus; 08-14-2011 at 01:56 AM..
# 2  
Old 08-14-2011
A common way is to send a mail to a user or a group of users asking them to do what is necessary to resume the job.
# 3  
Old 08-14-2011
more ideas ?

@jlliagre thanks for brainstorming with me, but the mail method still doesn't suffice, I want the cronjob to open a terminal and display the interaction while running.

I tried setting the environment variable using
00 12 * * * env DISPLAY=:0 /somecommand

but it still doesn't work.

Does anyone know how to use 'screen -x' command to ask for user input.

Thanks
# 4  
Old 08-14-2011
How is "env DISPLAY=..." failing ?
# 5  
Old 08-14-2011
What's your system? What's your x-server? DISPLAY is often insufficient these days, you have to be authorized too.
# 6  
Old 08-14-2011
My system is MAC OS X and X server is X 11
# 7  
Old 08-14-2011
"what kind of X server do you have?"
"11"
"What kind of car do you have?"
"blue"

Are you using the X server that came with OSX?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Homework & Coursework Questions

Removing punctuations from file input or standard input

Just started learning Unix and received my first assignment recently. We haven't learned many commands and honestly, I'm stumped. I'd like to receive assistance/guidance/hints. 1. The problem statement, all variables and given/known data: How do I write a shell script that takes in a file or... (4 Replies)
Discussion started by: fozilla
4 Replies

2. Shell Programming and Scripting

Reading from standard input

So, I am new to shell scripting and have a few problems. I know how to read from standard input but I do not know how to really compare it to say, a character. I am trying to compare it to a character and anything exceeding just a character, the user will get an output message, but the program... (7 Replies)
Discussion started by: Bungkai
7 Replies

3. Shell Programming and Scripting

Reading Standard Input

Hello, I am new to scripting. How do I read multiple lines from the command line? I know read reads one line, but if I have to read multiple lines, how should I do? Thanks, Prasanna (4 Replies)
Discussion started by: prasanna1157
4 Replies

4. Shell Programming and Scripting

Send data to standard input

Hello, I'm writting a korn script that executes a daemon in a remote server. The problem is that daemon doesn't go background until it receives an enter from the standard input, and it maintains the rsh opened until it get it. I'm looking for the best (efficient and elegant) way to do send the... (3 Replies)
Discussion started by: nefeli
3 Replies

5. Solaris

standard input

Please give me any example for standard input in Solaris. (6 Replies)
Discussion started by: karman0931
6 Replies

6. Shell Programming and Scripting

opening a file given as standard input

Hi I am trying to write a shell script which should take the file as standard input. As file(content and name both) will change for each run. It should read the file line by line. with each line I have to perform certain operation. For example I have i file foo, it looks like /usr/doc/abc... (4 Replies)
Discussion started by: shashiprakash81
4 Replies

7. Shell Programming and Scripting

Command Output to Standard Input

Hi All, How do I provide the output of a command to another command which is waiting for an input from the user ? Ex : I need to login to a device via telnet. In the script, initially I use the "read" command to get the IP Address, Username and Password of the device from the user. Now,... (1 Reply)
Discussion started by: sushant172
1 Replies

8. Shell Programming and Scripting

change standard input ?

Dear... I have a scrpit that contains multiple read command.... when I run the script I have to enter 3 variables so that I can get the output.. but, I dont want to put those 3 inputs manually every time... I want to make a shell that reads the 3 inputs from a file. the script name is... (4 Replies)
Discussion started by: yahyaaa
4 Replies

9. Shell Programming and Scripting

How to copy from standard input

I tried copy the output files from find command into a directory. Example, find / -name core 2>/dev/null | xargs cp???? I have known that we can use xargs to execute command lines from standard input but how to use it in this case. Or I can do something besides xargs. (2 Replies)
Discussion started by: lalelle
2 Replies

10. Shell Programming and Scripting

standard input

how can i redirect standard input? i dont remember :/, though could you redirec not from a command? i mean, to redirect always stdin and stout (1 Reply)
Discussion started by: Jariya
1 Replies
Login or Register to Ask a Question