Reviewing Output of GAM

852 views
Skip to first unread message

Frank LoCascio

unread,
Nov 2, 2012, 8:16:10 AM11/2/12
to google-ap...@googlegroups.com
When using the GAM Print functions, one can add >report.csv to have results stored in a csv file.  Works great

But what about the other GAM Commands

Example
I have a file .csv file with the following GAM commands

GAM update user aaac...@xxxxx.com username angel_...@xxxxx.com
GAM update user aaac...@xxxxx.com username anais_...@xxxxx.com
GAM update user aaaq...@xxxxx.com username alexis...@xxxxx.com
GAM update user aaa...@xxxxx.com username adrian...@xxxxx.com
GAM update user aaca...@xxxxx.com username axel_c...@xxxxx.com
GAM update user aacar...@xxxxx.com username abel_c...@xxxxx.com
GAM update user aacas...@xxxxx.com username alan_c...@xxxxx.com
GAM update user aacas...@xxxxx.com username adliyet_...@xxxxx.com
.
.
.

10,000 more update commands

What I usually do is copy this from my .csv file and paste into a DOS window, and one-by-one they execute

Issue is if any command fails it displays in the DOS window and eventually "rolls off" the screen

Is there any way I can capture the results of a long GAM run like this????

John Warf

unread,
Nov 2, 2012, 9:29:02 AM11/2/12
to google-ap...@googlegroups.com
What I do is dump my commands to a .bat file and then let it run.  When it runs I offset the screen print to a file or report.

ex....

newusers.bat > report-newusers.bat

Thanks
John



--
You received this message because you are subscribed to the "Google Apps Manager" group.
To post to this group, send email to
google-ap...@googlegroups.com
To unsubscribe from this group, send email to
google-apps-man...@googlegroups.com
For more options, visit this group at
https://groups.google.com/forum/#!forum/google-apps-manager

LoCascio, Frank

unread,
Nov 2, 2012, 9:31:53 AM11/2/12
to google-ap...@googlegroups.com
Perfect.... simple

Thanks
--



Frank LoCascio
Google Voice: (561) 299-0506
Cell: 561-715-5610
Skype: ffl003
 

   
For just about the cost of a good mouse, 
Google Apps gives your employees 
entry into the World of New Technology...
The REAL Cloud

This message is the property of eSource Capital & Technologies and contains information which may be privileged or confidential. It is meant only for the intended recipients and/or their authorized agents.  If you believe you have received this message in error, please notify us immediately by return e-mail and destroy any printed or electronic copies of the message.  Any unauthorized use, dissemination, disclosure, or copying of this message or the information contained in it, is strictly prohibited and may be unlawful.

Thank you for your cooperation.

Dan Westby

unread,
Nov 5, 2012, 8:50:04 AM11/5/12
to google-ap...@googlegroups.com
I always put "2>&1" at the end of my line so it grabs the errors too.

Like:
gam info user user_name >> c:\mylogfile.log 2>&1

You'll see a difference if you put the 2>&1 at the end.

-Dan

Godfried Borremans

unread,
Nov 19, 2012, 6:00:17 AM11/19/12
to google-ap...@googlegroups.com
On linux you can use the 'script' tool. See http://linux.die.net/man/1/script (or 'man script' on your computer).
"Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the typescript file can be printed out later."

How to use:
example: you want a report on all accounts
your command is: python gam.py report accounts
run following command:
script -f -c 'python gam.py report accounts' gamjob.log

the script will be executed and everything will be logged into the file gamjob.log and shown on the terminal.

If you have to do multiple actions like
(when a student leaves the school at the end of the year)
python gam.py update group cl...@student.ourschool.be remove member use...@student.ourschool.be
python gam.py update user use...@student.ourschool.be suspended on
python gam.py update org left_our_school add use...@student.ourschool.be
Then put all these commands in a text file (e.g. gamjob)
and run following command:
script -f -c '/bin/sh gamjob' gamjob.log
again the script will be executed and everything will be logged into the file gamjob.log and shown on the terminal.









Reply all
Reply to author
Forward
0 new messages