- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Ksh in backgroung
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
06-10-2002 07:03 AM
06-10-2002 07:03 AM
Ksh in backgroung
Hi All,
One more time I need your help. 2 Questions:
1-In the ksh at the attachment I??d like to get the vars ( file_exit and interval ) and put the script as a background job
2- Covert this ksh to perl ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2002 07:10 AM
06-10-2002 07:10 AM
Re: Ksh in backgroung
if [ "$1" -eq "" ]; then
read file_exit?" Please inform the output file: "
else
file_exit = $1
fi
if [ "$2" -eq "" ]; then
read interval?" Please inform the interval [ in seconds ]: "
else
interval = $2
fi
Then:
nohup scriptname.ksh outputfilename interval &
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2002 07:29 AM
06-10-2002 07:29 AM
Re: Ksh in backgroung
#!/usr/contrib/bin/perl
#
clear;
if ( "$ARGV[0]" eq "" ) {
print " Please inform the output file: ";
chomp($file_exit =
} else {
$file_exit = $ARGV[0];
}
if ( "$ARGV[1]" eq "" ) {
print "Please inform the interval [ in seconds ]: ";
chomp($interval =
} else {
$interval = $ARGV[1];
}
print "\n";
while (1) {
$i=0;
while ( $i < 1 ) {
$dia=`date +"%D"`;
$hora=`date +"%H:%M:%S"`;
`srvman -l|grep App > app.lst`;
`srvman -l|grep TOTAL > total.lst`;
$var_system=`cut -c 39,40,41,42 app.lst`;
$var_mem=`cut -c 39,40,41,42,43,44 total.lst`;
$var_caps=`cut -c 58,59,60,61,62 total.lst`;
`echo "Day=>${dia} Time=>${hora} System=>${var_system} Memory=>${var_mem}
Caps=>${var_caps}" | tee -a $file_exit`;
$i += 1;
}
sleep $interval;
}
exit 0;
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2002 07:31 AM
06-10-2002 07:31 AM
Re: Ksh in backgroung
#!/usr/bin/perl
die "Must supply file name!" unless $file_exit=$_[1];
$interval=$_[2];
$interval=60 unless $interval;
while(1) {
($sec,$min,$hr,$mday,$mon,$yr,$wday,$yday,$isdst)=localtime(time());
$mon++; $yr=substr($yr,-2);
$dia="$mon/$mday,$yr"; $hora="$hr:$min:$sec";
open(INP,"srvman -l|");
while(
/App/ && do {
$var_system=substr($_,38,4);
}
/TOTAL/ && do {
$var_mem=substr($_,38,6);
$var_caps=substr($_,57,5);
}
}
close(INP);
print "Day=>$dia Time=>$hora System=>$var_system Memroy=>$var_mem Caps=>$var_caps\n"
sleep $interval
}
You can then launch by entering
--> nohup myprog outputfile 120 &
to send the output to "outputfile" and a 120 second interval.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2002 10:04 AM
06-10-2002 10:04 AM
Re: Ksh in backgroung
Harry,
When I tried to put in bg I received the following message:
scpsmp linus> ./edu.sh bassoi 12&
[7] 4735
scpsmp linus> ls
app.lst exp_tpu4.dmp sql total.lst
bassoi exp_tpu4.log srvinst.log updlms.sh
edu.sh exp_tpu4.sh srvman.pl
edu.sh.old nohup.out teste.srvman.sh
[7] + Stopped(SIGTTOU) ./edu.sh bassoi 12&
scpsmp linus>
and so the script stop !!!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2002 10:28 AM
06-10-2002 10:28 AM
Re: Ksh in backgroung
repost your script with the changes you made.
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2002 11:29 AM
06-10-2002 11:29 AM
Re: Ksh in backgroung
Regards,
Bassoi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2002 11:29 AM
06-10-2002 11:29 AM
Re: Ksh in backgroung
Regards,
Bassoi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2002 12:02 PM
06-10-2002 12:02 PM
Re: Ksh in backgroung
sorry, try putting this at the top line:
#!/usr/bin/ksh
THen change the "IF's" to this:
if [ "$1" = "" ]; then
if [ "$2" = "" ]; then
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2002 12:52 PM
06-10-2002 12:52 PM
Re: Ksh in backgroung
Thanks to all !!!
Harry,
The solution using the ksh didn??t work.I used the stuffs like you told but nothing. The script stop with signal termination.
I??m using the Perl solution that works fine. One more doubt : How to monitoring, inside the script, what??s been writting in the output file ?
Regards,
Bassoi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2002 01:46 PM
06-10-2002 01:46 PM
Re: Ksh in backgroung
tail -f yourfile
Will display the last few lines of a file then wait for any additional lines.
-- Rod Hills