How to take spool of all the commands we execute on Linux server .

I am executing many commands on linux server an i want to take spool of them in a file. Can any one of you please let me know hoe to do this.

mun_786Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

medveddCommented:
If by spool you mean that you want to log all commands that you typed, use command script.

man script
0
mun_786Author Commented:
Here is the situation . I have a file called mun.sh .Which is shell script.  If i run that script i get some 3000 lines of code. I want to spool the  out put of the result  of the mun.sh . Below is my mun.sh file .

vrepo>more mun.sh
#!/bin/bash    
for ((j=1;j<=1000;j++))
  do
   
   echo " SELECT dbms_flashback.get_system_change_number FROM dual; "  ;
   echo " delete from PERF01.INTEX_CDO_TRANCHES  where name like 'Comp_%' and tranche_no=$j ;";
   echo " commit;"  ;
   echo " ";

  done


From SQL> promo i also tried to do spool like this.
SQL>spool mun.out
SQL> set echo on feedback on ;
SQL> !./mun.sh

SQL> spool off;
vrepo>

in mun.out nothing is there.




0
nociSoftware EngineerCommented:
Did you intend this?
Generate an SQL job from bash and then execute it & catch it's output...

---8<--- mun.sh
#!/bin/bash    
for ((j=1;j<=1000;j++))
  do
   
   echo " SELECT dbms_flashback.get_system_change_number FROM dual; "  ;
   echo " delete from PERF01.INTEX_CDO_TRANCHES  where name like 'Comp_%' and tranche_no=$j ;";
   echo " commit;"  ;
   echo " ";

  done
---8<---


Then use it:

---8<--- run_mun.sh:
#!/bin/bash
./mun.sh >run_mun.sql
sql  run_mun.sql  >>mun.out
---8<---
The syntax of the SQL command may vary, it should take mun.sql as a script to execute.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
EE_AutoDeleterCommented:
I've requested that this question be deleted for the following reason:

No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Not enough information to confirm an answer.

If you feel this question should be closed differently, post an objection and a moderator will read all objections and then close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Experts-Exchange Auto Deleter
0
nociSoftware EngineerCommented:
afaict it was what the asker intended...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux

From novice to tech pro — start learning today.