Sponsored Content
Operating Systems Linux Gentoo top in batch mode, cpu info is wrong Post 302225910 by broli on Sunday 17th of August 2008 05:53:46 PM
Old 08-17-2008
Quote:
Originally Posted by Franklin52
If the second iteration is correct you can shorten the delay with the -d option and print the result of the second iteration with awk, this works on a Debian Linux system:

Code:
top -b -n2 -d0.01 | awk '/^top/{i++}i==2' > somefile

Regards
thanks, but it didnt worked :/

this is a screenshot of my script (below) and top at the same time.
screenshot on Flickr - Photo Sharing!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help ! How to get elm to send multiple attachments - in batch mode

From a program, I want to execute a UNIX elm command that will send multiple txt attachment files to an email address. I can do it for one attachment only ie. "elm -s"subject" emailaddress < attachment.txt" 1. The attachment is received in the body of the email and not as an attachment. 2. The... (1 Reply)
Discussion started by: anarvan
1 Replies

2. Shell Programming and Scripting

su command in batch mode

Hi, how do we change user in a shell script- batch mode. Thanks, Rajesh (3 Replies)
Discussion started by: Rajesh Gohad
3 Replies

3. Shell Programming and Scripting

SSH in batch mode and File-Handles in a loop

Hi all I try to execute SSH commands on several hosts in a while-loop. There seems to be a problem with file-handle, first cycle works correct but no other one will follow due to the while condition is false even that there are many more host entries (lines) in all_hosts.dat. ... (3 Replies)
Discussion started by: DaveCutler
3 Replies

4. UNIX for Advanced & Expert Users

Sftp in Batch Mode

Hi, I am trying to do sftp a file from one server to another solaris server. Both are sftp enabled. I have generated the rsa key in local server and did a ftped the public key to the remote server and added that in the authorization keys file. Then i try to run the below command using a... (2 Replies)
Discussion started by: sivaemn
2 Replies

5. UNIX for Dummies Questions & Answers

how to get persistant cpu utilization values per process per cpu in linux (! top,ps)

hi, i want to know cpu utilizatiion per process per cpu..for single processor also if multicore in linux ..to use these values in shell script to kill processes exceeding cpu utilization.ps (pcpu) command does not give exact values..top does not give persistant values..psstat,vmstat..does njot... (3 Replies)
Discussion started by: pankajd
3 Replies

6. AIX

Need a list of top 10 CPU using processes (also top 10 memory hogs, separately)

Okay, I am trying to come up with a multi-platform script to report top ten CPU and memory hog processes, which will be run by our enterprise monitoring application as an auto-action item when the CPU and Memory utilization gets reported as higher than a certain threshold I use top on other... (5 Replies)
Discussion started by: thenomad
5 Replies

7. Shell Programming and Scripting

How to run VI in batch mode

Hi how do I use vi to do change some strings in a shell script loop 1. Run ls first, for each file that contains the word salesreport*.txt, do the following 2. use vi to run the following ex command : "1,$s/1975/1945/ig, wq" Please tell me how to do this in vi, not sed. Thank you. (5 Replies)
Discussion started by: grossgermany
5 Replies

8. HP-UX

how to run glance over ssh in batch mode

Hello; Is it possible to run glance over ssh in batch mode ?? Similar to running " top -f " command over ssh.. Need to get glance output for specific pids Thnx very much (5 Replies)
Discussion started by: delphys
5 Replies

9. Shell Programming and Scripting

FTP in batch mode

HI, Need to ftp a bunch of files in a directory in batch mode. TRying to ftp a single file first with below code. #!/bin/ksh function ftp_files { ftp -n ${D2_SRVR} <<-EOF quote user ${D2_UID} quote pass ${D2_PWD} cd ${D2_DIR}/${D2_NAME} lcd ${D1_DIR}/${D1_NAME}/dml/ put file1 ... (6 Replies)
Discussion started by: cvsanthosh
6 Replies

10. Shell Programming and Scripting

tftp batch mode within bash script

Hi, I put the necessary tftp commands into a batch file and I can run tftp by $ tftp < tftpbatchscript in bash command line and then successfully exit. Now, I want to put a line which does the same thing above. However, when I put this line into a bash script, the lines below this line... (1 Reply)
Discussion started by: yildiz.a
1 Replies
Upload(3pm)						User Contributed Perl Documentation					       Upload(3pm)

NAME
Flickr::Upload - Upload images to "flickr.com" SYNOPSIS
use Flickr::Upload; my $ua = Flickr::Upload->new( { 'key' => '90909354', 'secret' => '37465825' }); $ua->upload( 'photo' => '/tmp/image.jpg', 'auth_token' => $auth_token, 'tags' => 'me myself eye', 'is_public' => 1, 'is_friend' => 1, 'is_family' => 1 ) or die "Failed to upload /tmp/image.jpg"; DESCRIPTION
Upload an image to flickr.com. METHODS
new my $ua = Flickr::Upload->new( { 'key' => '90909354', 'secret' => '37465825' }); Instatiates a Flickr::Upload instance. The "key" argument is your API key and the "secret" is the API secret associated with it. To get an API key and secret, go to <http://www.flickr.com/services/api/key.gne>. The resulting Flickr::Upload instance is a subclass of Flickr::API and can be used for any other Flickr API calls. As such, Flickr::Upload is also a subclass of LWP::UserAgent. upload my $photoid = $ua->upload( 'photo' => '/tmp/image.jpg', 'auth_token' => $auth_token, 'tags' => 'me myself eye', 'is_public' => 1, 'is_friend' => 1, 'is_family' => 1 'async' => 0, ); Taking a Flickr::Upload instance $ua as an argument, this is basically a direct interface to the Flickr Photo Upload API. Required parameters are "photo" and "auth_token". Note that the "auth_token" must have been issued against the API key and secret used to instantiate the uploader. Returns the resulting identifier of the uploaded photo on success, "undef" on failure. According to the API documentation, after an upload the user should be directed to the page <http://www.flickr.com/tools/uploader_edit.gne?ids=$photoid>. If the "async" option is non-zero, the photo will be uploaded asynchronously and a successful upload returns a ticket identifier. See <http://flickr.com/services/api/upload.async.html>. The caller can then periodically poll for a photo id using the "check_upload" method. Note that photo and ticket identifiers aren't necessarily numeric. check_upload my %status2txt = (0 => 'not complete', 1 => 'completed', 2 => 'failed'); my @rc = $ua->check_upload( @ticketids ); for( @rc ) { print "Ticket $_->{id} has $status2txt{$_->{complete}} "; print " Photo id is $_->{photoid} " if exists $_->{photoid}; } This function will check the status of one or more asynchronous uploads. A list of ticket identifiers are provided (@ticketids) and each is checked. This is basically just a wrapper around the Flickr API "flickr.photos.upload.checkTickets" method. On success, a list of hash references is returned. Each hash contains a "id" (the ticket id), "complete" and, if completed, "photoid" members. "invalid" may also be returned. Status codes (for "complete") are as documented at <http://flickr.com/services/api/upload.async.html> and, actually, the returned fields are identical to those listed in the "ticket" tag of the response. The returned list isn't guaranteed to be in any particular order. This function polls a web server, so avoid calling it too frequently. make_upload_request my $req = $uploader->make_upload_request( 'auth_token' => '82374523', 'tags' => 'me myself eye', 'is_public' => 1, 'is_friend' => 1, 'is_family' => 1 ); $req->header( 'X-Greetz' => 'hi cal' ); my $resp = $ua->request( $req ); Creates an HTTP::Request object loaded with all the flick upload parameters. This will also sign the request, which means you won't be able to mess any further with the upload request parameters. Takes all the same parameters as upload, except that the photo argument isn't required. This in intended so that the caller can include it by messing directly with the HTTP content (via $DYNAMIC_FILE_UPLOAD or the HTTP::Message class, among other things). See "t/" directory from the source distribution for examples. Returns a standard HTTP::Response POST object. The caller can manually do the upload or just call the upload_request function. upload_request my $photoid = upload_request( $ua, $request ); Taking (at least) LWP::UserAgent and HTTP::Request objects as arguments, this executes the request and processes the result as a flickr upload. It's assumed that the request looks a lot like something created with make_upload_request. Note that the request must be signed according to the Flickr API authentication rules. Returns the resulting identifier of the uploaded photo (or ticket for asynchronous uploads) on success, "undef" on failure. According to the API documentation, after an upload the user should be directed to the page <http://www.flickr.com/tools/uploader_edit.gne?ids=$photoid>. file_length_in_encoded_chunk $HTTP::Request::Common::DYNAMIC_FILE_UPLOAD = 1; my $photo = 'image.jpeg'; my $photo_size = (stat($photo))[7]; my $req = $ua->make_upload_request( ... ); my $gen = $req->content(); die unless ref($gen) eq "CODE"; my $state; my $size; $req->content( sub { my $chunk = &$gen(); $size += Flickr::Upload::file_length_in_encoded_chunk($chunk, $state, $photo_size); warn "$size bytes have now been uploaded"; return $chunk; } ); $rc = $ua->upload_request( $req ); This subroutine is tells you how much of a chunk in a series of variable size multipart HTTP chunks contains a single file being uploaded given a reference to the current chunk, a reference to a state variable that lives between calls, and the size of the file being uploaded. It can be used used along with HTTP::Request::Common's $HTTP::Request::Common::DYNAMIC_FILE_UPLOAD facility to implement upload progress bars or other upload monitors, see flickr_upload for a practical example and t/progress_request.t for tests. SEE ALSO
<http://flickr.com/services/api/> Flickr::API AUTHOR
Christophe Beauregard, cpb@cpan.org COPYRIGHT AND LICENSE
This module is not an official Flickr.com (or Ludicorp, or Yahoo) service. Copyright (C) 2004,2005 by Christophe Beauregard This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.3 or, at your option, any later version of Perl 5 you may have available. perl v5.10.0 2008-10-27 Upload(3pm)
All times are GMT -4. The time now is 05:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy