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?
 
nociConnect With a Mentor Software 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
 
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
 
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
All Courses

From novice to tech pro — start learning today.