[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

there is supposed to be a way in bash / ksh to record your session ?

Posted on 2011-05-05
11
Medium Priority
?
456 Views
Last Modified: 2012-05-11

I run scripts and find out stuff from many boxes using remote commands

I would like to record my local screen

is it ez ?

0
Comment
Question by:TIMFOX123
  • 4
  • 3
  • 3
  • +1
11 Comments
 
LVL 20

Expert Comment

by:n2fc
ID: 35701707
Every time you issue a command to the Korn shell, in addition to executing the command, the shell adds it to a list of previously executed commands.

To view the list of previously executed commands, issue the history command. This displays a number (up to the number set in $HISTSIZE) of previously issued commands. $HISTSIZE is set in .profile.

Before you can recall and edit the history list directly, you must issue the ksh command set -o vi to set the vi editing mode in the shell. Similarly, the following command line sets emacs editing mode in the shell:

set -o emacs
or set -o vi (if you prefer)

0
 
LVL 81

Expert Comment

by:arnold
ID: 35703253
run the command script
When you are done capturing the terminal hit Ctrl-D
the file is typescript.

Note that you only get the commands executed in the shell?  This is not a keylogger.
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 35704349
If you want to 'record' the output of your remote scripts and the output goes to your screen normally, you can just redirect the output to a (daily) file. You could write simple wrapper script that calls your remote script and redirects output to something like ~/log/`date +%Y%m%d`.log
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:TIMFOX123
ID: 35709879
Arnold
Tell me more :)

I want to file to cover my "6" if there is an issue on the box.

0
 
LVL 81

Expert Comment

by:arnold
ID: 35710422
Could you explain what it is you are trying to achieve?
Are you creating a script and need to build the request/response process?
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 35711970
I agee with Arnold, what do you want to achieve? If you just want a log of what you've done, whatever mandatory check you're supposed to do, just your shell history should be enough. If you want to create proof of some kind then I suggest you create a set of cron jobs that run your check scripts, including sending mail to you, your boss etc. Creating cron jobs is a good way of working anyway, jobs I create run regularly, write output including timestamps to (daily/monthly) logfiles and send messages (warning) is something is wrong.
0
 

Author Comment

by:TIMFOX123
ID: 35719668
I just want to log of the local screen for future reference.

the whole thing, not just the history.

0
 
LVL 81

Accepted Solution

by:
arnold earned 2000 total points
ID: 35719795
run script and see if that is what you want.
script
run commands
exit #this will terminate script and will save the typescript file.
more typescript
Alternatively, you want to specify a filename that changes with the data on which it runs
script   -a script_fle.`date +"%Y%m%d"`

The -a flag will append data to the file, if you run it multiple times per day.  

0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 35719883
Do you have 'screen'? screen will do what you ask, start like this:

screen -L

Open in new window


Will log to ~/screenlog.<number> whatever you do, including commands and output.
0
 

Author Closing Comment

by:TIMFOX123
ID: 35728179
this is exactly what I needed.  

Screen is good but it is not multiplatform.  

script apparently runs in solaris :)
0
 
LVL 38

Expert Comment

by:Gerwin Jansen, EE MVE
ID: 35728658
Yes, screen is not multiplatform, but if you run screen on a linux box and call your remote Solaris script, it will work just fine ;)
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Every server (virtual or physical) needs a console: and the console can be provided through hardware directly connected, software for remote connections, local connections, through a KVM, etc. This document explains the different types of consol…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question