- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Unix Script
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
тАО02-24-2009 05:12 AM
тАО02-24-2009 05:12 AM
Unix Script
Kindly suggest how to call the second script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2009 05:31 AM
тАО02-24-2009 05:31 AM
Re: Unix Script
At the end of script1, call script2 to run in the background and return to shell using &
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2009 05:55 AM
тАО02-24-2009 05:55 AM
Re: Unix Script
i tried in background also...but it is waiting till second script completes, then it continues the next line..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2009 06:02 AM
тАО02-24-2009 06:02 AM
Re: Unix Script
if yes, then you need to do
nohup script2 /dev/null 2>&1 &
- if you want the errors and output of that scrip then
nohup script2 /tmp/result 2>&1 &
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2009 10:09 PM
тАО02-24-2009 10:09 PM
Re: Unix Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-24-2009 10:44 PM
тАО02-24-2009 10:44 PM
Re: Unix Script
Suppose I have 2 script /tmp/s1.sh and /tmp/s2.sh and i need both the script should run in a single shot.
in this case I have to make a 3rd file name
vi /tmp/main.sh
sh /tmp/s1.sh &
sh /tmp/s2.sh &
save the file
now run sh /tmp/main.sh
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2009 12:28 AM
тАО02-25-2009 12:28 AM
Re: Unix Script
Actually I want to run another script2 through script1 and script1 should not wait for completion of script2.
and second question is how can I write a script to check continously the contents of log file and once the particular string found in log file that script will do the required action.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2009 01:51 AM
тАО02-25-2009 01:51 AM
Re: Unix Script
Call the second script "script2" as below ,
script2.sh >/dev/null 2>&1 &
exit
It works
Regards
Sanil
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2009 02:05 AM
тАО02-25-2009 02:05 AM
Re: Unix Script
>>Actually I want to run another script2 through script1 and script1 should not wait for completion of script2.
here also script 1 will not wait for script 2 if you call 2nd script from last line of the script 1 then it will executed once 1 st script will finish his job.
>> and second question is how can I write a script to check continously the contents of log file and once the particular string found in log file that script will do the required action.
If you wana search a string for a file then you have to used grep command and you have to run this command through crontab you can set 1 min to 59 min├в s interval to search string from a file.
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-25-2009 02:07 AM
тАО02-25-2009 02:07 AM
Re: Unix Script
So it is usefull when you use ssh forcing the use of a pty ( -t ) when doing a remote command
- or run an interactive ssh, start your script , exit from the ssh.
if no specific options are used, ssh will use pipes as stdin&out&err of the child process.
sshd will wait until all process using the other side of those pipes close it before exiting.
so if you do not redirect inputs and outputs it makes that sshd wait for that script to exit before exiting itself
since it is pipes no SIGHUP is sent on closure, so nohup is not necessary if no -t option is used on ssh or if the script can't be start interactively.