- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Calling Telnet from a Script called from Cron
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2008 05:13 AM
тАО08-28-2008 05:13 AM
Scripting is something rare to non-existent in our environment, so I apologize in advance.
I've searched several sites, forums etc, but I'm not able to put the 2 and 2 together on this.
What we have is a script that runs at regular intervals and looks for a file in a folder. When the file is there, we have a While/Do that calls a 2nd script that will telnet into itself, and issue keyboard commands (echo) to log in and process the file.
When fired off manually, the 1st script sees the new file, calls the 2nd script and processes the file perfectly (well it works anyway...LOL).
When we have the execution ran from the cron process, the log (Cron) doesn't show anything of real value. The 1st script files off, calls the 2nd script but I think I'm missing something, since it doesn't actually run. The first script does finish as it moved the file to the "processed" subfolder. I know this is really basic stuff, but any help is greatly appreciated!
Here is the 2nd script (edited for content):
( echo open myself
sleep 2
echo login
sleep 1
echo password
sleep 1
echo more commands
echo log out of application
) | telnet
I know, I know, color me stupid. Having a real brain fart today.
Thanks a million!!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2008 05:19 AM
тАО08-28-2008 05:19 AM
Re: Calling Telnet from a Script called from Cron
You must remember that the environment in cron is very sparse. Your /etc/profile and ~/.profile do NOT get sourced so any PATH or other environment variables you have when logged in are NOT available.
If you are referencing any variables in your scripts, double check and make sure those variables are defined in the script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2008 05:27 AM
тАО08-28-2008 05:27 AM
Re: Calling Telnet from a Script called from Cron
I'm purely passing keystrokes to the telnet session. I'm not using any variables (so far).
I keep finding data that points to environment as you described, but what would I actually need?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2008 05:28 AM
тАО08-28-2008 05:28 AM
Re: Calling Telnet from a Script called from Cron
How about remsh or ssh and supply the commands.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2008 05:30 AM
тАО08-28-2008 05:30 AM
Re: Calling Telnet from a Script called from Cron
Can you tell me how did you set cron entry here...?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2008 05:35 AM
тАО08-28-2008 05:35 AM
Re: Calling Telnet from a Script called from Cron
From the contab -l :
0,5,10,15,20,25,30 12-20 * * * /usr/ndm/tmp/dir/./File1.scr > /usr/ndm/tmp/dir/File1.log
The log files are empty.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2008 05:49 AM
тАО08-28-2008 05:49 AM
Re: Calling Telnet from a Script called from Cron
cd /usr/ndm/dir1/Inbound
ls file1*.csv | while read file
do
/usr/ndm/tmp/dir/./Script2.scr
mv file1*.csv /usr/ndm/dir1/Inbound/done/
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2008 05:54 AM
тАО08-28-2008 05:54 AM
Re: Calling Telnet from a Script called from Cron
Can you attach both scripts here...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2008 06:08 AM
тАО08-28-2008 06:08 AM
Re: Calling Telnet from a Script called from Cron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-28-2008 06:09 AM
тАО08-28-2008 06:09 AM