When were all scripts on the Solaris server last executed?


 
Thread Tools Search this Thread
Operating Systems Solaris When were all scripts on the Solaris server last executed?
# 8  
Old 11-20-2018
Quote:
Originally Posted by josamy
I need to migrate the scripts to Linux but I would like to know which ones are currently being executed rather than migrating all 500 of them.
Is there a way in Solaris 5.9 to do this? I have googled and I believe there is a way in the later versions but not sure about this ancient version.
Solaris 9 is old (released in 2002, supported until 2014), but is not ancient. The "ls" command hasn't substantially changed in the last 3 or 4 four decades so identifying the scripts that have been accessed is a first and easy step. Same for accounting which was supported by Solaris 9.

Anyway, a simple method to identify if existing scripts are executed is to wrap them with a logger script.

For example, assuming you have several shell scripts in the /opt/local/bin directory

You create a directory /opt/local/bin_org and move the scripts you want to monitor in it, then you create a wrapper script and have the system using it when the original scripts are expected:

Code:
cd /opt/local/bin/
cat > .wrapper <<%
#!/bin/ksh
echo \$0 "\$@" called at \$(PATH=$(getconf PATH) date +%Y%m%dT%H%M%S) >> /var/tmp/scriptLogs
exec \$(PATH=$(getconf PATH) dirname \$0)/../bin_org/\$(PATH=$(getconf PATH) basename \$0) "\$@"
%
chmod +x .wrapper
for script in ../bin_org/*; do
    ln .wrapper $(basename $script)
done

Execution logs will be in /var/tmp/scriptLogs
These 2 Users Gave Thanks to jlliagre For This Post:
# 9  
Old 11-27-2018
Sorry for the delay in responding and thanks for all your responses.


So basically I am in the process of migrating from Solaris 5.9 to Linux.


We are in the build stage and the Linux system is currently run by another vendor who cannot/ will not confirm what scripts are currently running.


There are over 500 shell scripts on the old Solaris server and I have no idea which ones I need to migrate to Linux.


Hence the question about how do I know what is currently being executed.


I am in the process of wading through the crontabs but was looking for a more time effective method of identifying currently used scripts.


Cheers
# 10  
Old 11-27-2018
Why not just copy over all the files (scripts) and be done with it for now?

That way you will not have many mistakes.
# 11  
Old 11-29-2018
Alternatively, you might just move to a supported Solaris Version (11.4), or to an OpenSolaris now Illumos derivative...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

List commands executed on a server

Hi All, how to list all the commands executed by users on a linux server.... I dont have access to others .bash_history. and i am not root user.. Please help.. Thanks in advance.. (6 Replies)
Discussion started by: nanz143
6 Replies

2. Shell Programming and Scripting

Multiple shell scripts executed in one script

Hi every one, i am new to shell script. my people given a task to write a shell script that should execute number of shell scripts in that. in that, if any shell script is failed to execute, we have to run the main script again, but the script should start execute from the failed script only.. it... (6 Replies)
Discussion started by: Madhu Siddula
6 Replies

3. Shell Programming and Scripting

Multiple shell scripts executed in one script

Hi every one, i am new to shell script. my people given a task to write a shell script that should execute number of shell scripts in that. in that, if any shell script is failed to execute, we have to run the main script again, but the script should start execute from the failed script only.. it... (1 Reply)
Discussion started by: Madhu Siddula
1 Replies

4. UNIX for Advanced & Expert Users

Procedure to be executed from shell scripts

Hi, I am looking for a script wherein i will be able to execute below procedures one by one in line and next procedures starts only when the previous one completes and also after execution of each procedure i will be getting a automted mail as "PL/SQL PROCEDURE SUCCESSFULLY EXCETUTED". ... (1 Reply)
Discussion started by: sv0081493
1 Replies

5. Solaris

Scripts in solaris server

hi, i want to know whether we can use both perl and unix shell in a single script in Solaris server (4 Replies)
Discussion started by: chn10db001
4 Replies

6. Solaris

application compiled on solaris 10 throwing error when executed on solaris 9

I have compiled my application on Solaris 10 with following description SunOS ldg1 5.10 Generic_138888-03 sun4v sparc SUNW,Sun-Blade-T6320 The compiler is Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25 But when installing the application on Solaris 9 SunOS odcarch02 5.9... (2 Replies)
Discussion started by: ash_bit2k2
2 Replies

7. Solaris

Solaris audit to syslog - where is arguments to the commands executed?

Hi, we have server, that is auditing actions executed, and then sends them to the syslog server. But there is arguments to issued to the commands in the audit trail, but there is no such arguments in the syslog output on the syslog server! Example - I executed: # ls -la audit... (1 Reply)
Discussion started by: masloff
1 Replies

8. Linux

Script under rc3.d not being executed on server bootup

Hello all, I have a script callled 'ABCstartup' setup under /etc/rc.d/init.d Softlink 'S91ABCstartup' pointing to above script has been created under /etc/rc.d/rc3.d The script is not being executed when the server restarts. The script runs successfully via manual execution:... (5 Replies)
Discussion started by: hemangjani
5 Replies

9. Programming

Binary not getting executed from Java on Solaris environment

In the Java programme, I am calling function, "Runtime.getRuntime().exec( cmdarray ); " with the array of arguments in which first argument is the binary(C-executable) file and argv1,argv2 and so on. This will be executed on Sun OS system.. I can execute using "sh -c cmdarray" on the shell... (0 Replies)
Discussion started by: shafi2all
0 Replies

10. Shell Programming and Scripting

Staus of Executed Scripts

Hi There, I have 3 scripts that have to be run one after the other. All 3 scripts are dependent of the other. Now, If I am about to run the second script, assuming that the first script has already been run, can I get the status of the first script. The problem is that, My second script has... (11 Replies)
Discussion started by: pathanjalireddy
11 Replies
Login or Register to Ask a Question