- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Running scripts fron 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
Forums
Discussions
Discussions
Discussions
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
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
11-20-2007 05:16 PM
11-20-2007 05:16 PM
I am using HP-UX taaput01 B.11.11 U 9000/800.
I have one sh scripts xyz.sh.
./xyz.sh
it ask enter the port no .
If i want to run it fron cron then how can i supply the input to this scripts.
Could some one please give some thought.
Regard's
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2007 07:26 PM
11-20-2007 07:26 PM
Re: Running scripts fron cron
You modify your script xyz.sh to accept the first parameter $1 with port number. In the script the value of variable $1 is the one passed as parameter to xyz.sh from the prompt. If port number is static, you need not have this parameter rather you could hardcode it.
you can define cron job as
0 15 * * */home/abc/xyz.sh 5320 >/dev/null 2>&1
Thanks,
Srikanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2007 07:35 PM
11-20-2007 07:35 PM
Re: Running scripts fron cron
I can understand this. But suppose we can not update the scripts, in that case is it possible or not?
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2007 07:53 PM
11-20-2007 07:53 PM
Re: Running scripts fron cron
Cron is more for non-interactive scripts! You cannot change its behaviour. Of course, you can run the script using the cron and which takes its input from a file.
e.g.
...
INPUT=$(cat /home/yogeeraj/mvar.txt)
if [ $INPUT = 'XYZ' ]; then
...
hope this helps!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2007 07:54 PM
11-20-2007 07:54 PM
Re: Running scripts fron cron
Cron is more for non-interactive scripts! You cannot change its behaviour. Of course, you can run the script using the cron and which takes its input from a file.
e.g.
...
INPUT=$(cat /home/yogeeraj/portnum.txt)
if [ $INPUT = 'XYZ' ]; then
...
hope this helps!
kind regards
yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2007 07:56 PM
11-20-2007 07:56 PM
Solutionyou can do the following :
1. create a file abc and put the port no. into it
# cat 999 > /tmp/abc
2. now run xyz.sh and redirect input to /tmp/abc.
# ./xyz.sh < /tmp/abc
3. Now use the same in cron
10 10 * * * /path/xyz.sh < /path/abc
Regards,
RD
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2007 08:29 PM
11-20-2007 08:29 PM
Re: Running scripts fron cron
Thanks it is working for me.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2007 08:31 PM
11-20-2007 08:31 PM
Re: Running scripts fron cron
I am closing this thread. I got satisfactory answer.
Thanks