Following your steps I get no prompt at all, it just print the output.
swmml works like perl (it is a perl script): if you want to execute "on the fly" command in perl you write:
I used the word "interactive" because if I execute swmml by its own it enters a shell like the following:
Thanks!
What are you trying to achieve ?
Before scripting something you must ensure that the intermediate commande give the intended result.
Example if you want a script toto.sh that display your hostnae and full id
after having check that
and
give the result you need you can just
Now if you intend to get output from some swmml command, you first have to ensure that when you run it manually it generate the expected output, you will then be able to start coding the handling of the output according to your needs.
To far if you just want "Hello World" to be Displayed :
Dear all,
it seems that today I can't explain myself very well.
Please forgive me and let me try one last time.
I'll try to start from the beginning:
#1
I need to retrieve some information with the following script:
If I execute the script from command line (root user) it works fine and outputs something like the following:
#2
Now I want to launch the swmml_D_PROCESS.sh script in root's crontab:
#3
All I get from the above is the following swmml_D_PROCESS.log:
Quote:
ERROR: STDIN is a character special file
instead of the expected output (#1).
#4
Since the above didn't work I tryed to reduce at minimum the commands being executed, this lead to the "su - omniusr ...." in crontab, but no success.
#5
I tryed one more thing in crontab:
But nothing changed.
Please, let me know if I miss some informations.
Thanks to all of you for helping me
---------- Post updated at 04:30 PM ---------- Previous update was at 04:29 PM ----------
Bravo Skrynesaver!
Now that we made one step forward can anybody explain why if I launch the script from command line it works while if I put it in crontab it doesn't work?
Maybe something is missing from the crontab environment?
What's missing is a terminal
STDIN and STDOUT are character devices rather than ttys when called from cron.
If you modify the script to remove the check it will probably break somewhere else (I don't know the script at all) however it may be possible to isolate where it breaks and resolve the issue using the Expect module or similar, however that may be a complex Perl coding issue
The reason few won't work from CRON but from command line is due to non availability of it's environment from CRON. The same problem I found is with sqlplus which works OK from command line but not from CRON.
For that I have to set my ORACLE_HOME and ORACLE_SID etc explicitly in the script I am executing from cron .
In your case ,
check if the "swmml" env is available to run from cron, if not set it before invoking it.
#3
All I get from the above is the following swmml_D_PROCESS.log:
ERROR: STDIN is a character special file
That is coming from your program. Did you try commenting out that code block because it clearly does not work when run from cron?
Quote:
#5
I tryed one more thing in crontab:
Code:
15 * * * * . /etc/profile; /scripts/swmml_D_PROCESS.sh > /scripts/swmml_D_PROCESS.log 2>&1
Your original version was better. This version runs the script as the wrong user and does not set the environment correctly.
The lines to choose the right Shell and then set up the environment need to be at the beginning of the script /scripts/swmml_D_PROCESS.sh if "su - username" gives trouble.
Hello folks.
I will start out by saying as far as unix/linux scripting goes I know less about it than i do about giving birth (I'm a guy hehe). I am looking to make a shutdown script that will either shut down the system or reboot it using one of the shutdown run methods IE init 2 - 5 or a base... (1 Reply)
I have script, which need some variable from user and i use below command for this
read
this script works fine while running without background, but when i run this script in background, it ask first variable then immediately it show below error
KSH variable not found
please let me... (1 Reply)
Hi,
I have a python gui which allow users entering the root password, then a bash script is called to run "su" with the root password on the background. I could find a way to run "su" with a password. How to run "su" in a bash script without password prompt?
Thank you. (4 Replies)
Hi,
I am writing an interactive shell script (ksh) but I have no idea how I could make a condition on it :
Variables :
rep_config="${rep_tools}/_CONFIG"
rep_config_old="${rep_config}/_PROTO_OLD"
Here is the interactice part :
lst_proto=$(cat... (2 Replies)
Q. Write a script that behaves both in interactive and non interactive mode. When no arguments are supplied it picks up each C program from the directory and prints first 10 lines.
It then prompts for deletion of the file.
If user supplies arguments with the script , then it works on those files... (8 Replies)
Q. Write a script that behaves both in interactive and non interactive mode. When no arguments are supplied it picks up each C program from the directory and prints first 10 lines.
It then prompts for deletion of the file.
If user supplies arguments with the script , then it works on those files... (1 Reply)
I have a script that will install software on all remote host. At the end of the script it starts the install.sh part and goes into a interactive mode asking Yes or No questions and prompting to add a username and password. My question is how can I script this so that these questions are... (7 Replies)
Gud morning everybody,
I need small help form you people,Please advice me.
I have a utility(adpatch) which takes 10-15 prompts, i want to automate this by calling this utility in shell script. Now my qiestion i want to run the script in non interactive mode.
An example.
$adpatch... (1 Reply)
Does anyone know of a program to wrap an interactive script into an application..I tried using platypus but i want a utility to allow interactive scripts to be run in a stand-alone window to avoid .profile settings on multiple computers...platypus provides the option of a text window output but... (0 Replies)