03-27-2012
Comparing a text file's entries with ps -ef output
Shell : Korn
os : AIX
This is the ps output looking for a process called pmon. pmon runs with various 'service' names which is appended with an underscore as shown below.
For example a pmon process for the service hexjkm will be named ora_pmon_hexjkm
HTML Code:
$ ps -ef | grep pmon
oracle 4128852 1 0 Nov 10 - 14:59 ora_pmon_hexjkm
oracle 4849792 1 0 Nov 10 - 15:04 ora_pmon_yevnes
oracle 7274610 1 0 Nov 10 - 20:50 ora_pmon_ceespr
oracle 7471232 1 0 Nov 10 - 23:25 ora_pmon_niclkn
oracle 8913076 1 0 Nov 10 - 19:12 ora_pmon_lmstpu
oracle 11403284 1 0 Nov 10 - 19:31 ora_pmon_cectpr
oracle 13107282 1 0 Nov 10 - 14:47 ora_pmon_cesass
oracle 15270050 1 0 Nov 10 - 19:30 ora_pmon_ukcocs
oracle 16318666 1 0 Nov 10 - 27:05 ora_pmon_fgcocs
oracle 16580818 1 0 Nov 10 - 14:53 ora_pmon_ceesbr
oracle 16646356 1 0 Nov 10 - 19:42 ora_pmon_plcocs
oracle 16711894 1 0 Nov 10 - 16:05 ora_pmon_ceboas
oracle 21364870 1 0 Nov 10 - 24:17 ora_pmon_cecocr
oracle 22741182 1 0 Nov 10 - 24:52 ora_pmon_ceclcr
oracle 24903694 1 0 Feb 16 - 4:56 ora_pmon_emcops
oracle 29032624 1 0 Feb 16 - 4:42 ora_pmon_emcopr
oracle 43122910 1 0 Mar 23 - 0:29 ora_pmon_cecmcr
oracle 6947270 1 0 Nov 10 - 17:45 ora_pmon_emcwar
oracle 7078360 1 0 Nov 10 - 18:43 ora_pmon_emcwas
oracle 7602490 1 0 Jan 06 - 13:37 ora_pmon_cetcnc
oracle 7930212 1 0 Nov 10 - 17:44 ora_pmon_ceurfs
oracle 38666612 1 0 Feb 21 - 8:55 ora_pmon_cecmcs
oracle 45809970 1 0 Mar 08 - 4:15 ora_pmon_wtcocs
oracle 63701382 1 0 Feb 24 - 7:38 ora_pmon_facuyr
oracle 16056858 1 0 Feb 15 - 5:08 ora_pmon_cecpcs
oracle 21824140 1 0 Mar 19 - 0:51 ora_pmon_lebtcs
oracle 52232842 1 0 Mar 08 - 2:41 ora_pmon_uedopl
Below is text file named mustRun.lst, which contains entries of service names.
HTML Code:
$ cat mustRun.lst
yevnes
ceboas
ukcocs
plcocs
fgcocs
cecocr
cesass
ceurfs
cecpcs
ceclcr
ceesbr
cectpr
cecmcr
cecmcs
ceespr
niclkn
hexjkm
lebtcs
cetcnc
facuyr
lmstpu
emcwar
emcopr
emcwas
emcops
uedopl
wtcocs
Every morning I need to check a set of mandatory processes (listed in mustRun.lst) and make sure that it is running (ie. present in ps output)
So, I need to find the service names which are present in mustRun.lst file but absent from ps -ef output. Is there any way to do this using scripting ?
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi All,
I'm really new to Unix scripts and commands but i think i'm eventually getting the hang of some of it.
I have a task which is to create some kind of script which compares the file names in a directory, with the associated file name in a .txt file. We send out some data and Unix has a... (1 Reply)
Discussion started by: gman
1 Replies
2. Shell Programming and Scripting
I have a text file in which holidays are listed as YYYYMMDD. Here is the sample data of the file.
20090911
20090912
20090913
I need to read this file and see if the current day is listed in this text file. If today and any of the rows in my text file match, I need to do further... (2 Replies)
Discussion started by: Pramodini Rode
2 Replies
3. Shell Programming and Scripting
Hi,
I have two files , one file with data file with attributes that need to be sent to another file to generate a predefined format.
Example:
File.txt
AP|{SSHA}VEEg42CNCghUnGhCVg==
APVG3|{SSHA}XK|"password"
AP3|{SSHA}XK|"This is test"
....
etc
---------
test.sh has... (1 Reply)
Discussion started by: hudson03051nh
1 Replies
4. Shell Programming and Scripting
hi,
I need a script which can format the below text file which contains comments
file1.txt
--------
//START
//Name: some value
//Date:
//Changes:.............
//.....................
//END
//START
//Date:
//Name: some value
//Changes:.............
//..................... (3 Replies)
Discussion started by: flamingo_l
3 Replies
5. UNIX for Dummies Questions & Answers
My project is to get a temperature reading from a refridgerator every 2 minutes and check to see if the door has been left open.
I don't yet have the mastery of Linux, being a complete noob, but I reckon I need a text file with the latest temperature reading in it. This I've managed to do by... (2 Replies)
Discussion started by: Fitch
2 Replies
6. UNIX Desktop Questions & Answers
Hi, Good day.
I currently have this data called database.txt and I would like to check if there are no similar values (all unique) on an entire row considering the whole column data is unique. the data is as follows
cL1 cL2 cL3 cL4
a12 c13 b13 c15
b11 a15 c19 b11
c15 c17 b13 f14
with... (1 Reply)
Discussion started by: whitecross
1 Replies
7. Shell Programming and Scripting
Hi Guys,
I need to compare the sql output with a column present in a file.
I am able to read the column from the file and stored in a variable.
Can somebody help how to store output of the below query to a variable. The database is Oracle.
Select count(*) from tableName;
... (2 Replies)
Discussion started by: mac4rfree
2 Replies
8. Shell Programming and Scripting
I have 2 files of almost same text apart from 2,3 ending lines. Now I want to get that difference in another file.
e.g file1.txt is
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_livecd-lv_root
18G 2.4G 15G 14% /
tmpfs 504M ... (12 Replies)
Discussion started by: kashif.live
12 Replies
9. Shell Programming and Scripting
Hello all,
I need to write a script which has following requirement:
Need to read the filenames from text file and then search for the above read files in the required directory and if match found backup them in a backup folder.
And also need to compare and verify whether the files in the... (7 Replies)
Discussion started by: saurau
7 Replies
10. Shell Programming and Scripting
Hello I'm having a little difficulty in writing a shell script for a few simple tasks.
First I have two files "file1.txt" and "file2.txt" and I want to read and compare the last line of each file. The files look like this.
File1.txt
File2.txt
After comparing the two lines I would... (2 Replies)
Discussion started by: RustikGaming
2 Replies
LEARN ABOUT DEBIAN
make-jpkg
MAKE-JPKG(1) General Commands Manual MAKE-JPKG(1)
NAME
make-jpkg - builds Debian packages from Java binary distributions
SYNOPSIS
make-jpkg [OPTION]... [FILE]
DESCRIPTION
make-jpkg builds a Debian package from the given Java distribution FILE.
Supported java binary distributions currently include:
* Oracle (http://www.oracle.com/technetwork/java/javase/downloads) :
- The J2SE Development Kit (JDK), version 6 (update >= 10), 7
- The J2SE Runtime Environment (JRE), version 6 (update >= 10), 7
- The J2SE API Javadoc, version 6 (update >= 10), 7
(Choose tar.gz archives or self-extracting archives, do _not_ choose the RPM!)
The following options are recognized:
--full-name NAME
full name used in the maintainer field of the package
--email EMAIL
email address used in the maintainer field of the package
--changes
create a .changes file
--revision
add debian revision
--help display help text and exit
--version
output version information and exit
Download a supported Java RE or SDK or API tar.gz or self-extracting archive from http://www.oracle.com/technetwork/java/javase/downloads
and execute make-jpkg file with the downloaded file. The program asks the user for additional information and builds a Debian binary pack-
age in the current directory.
The program requires about 200 MB free disk space in a temporary directory. The temporary directory defaults to /tmp but you can specify an
alternate directory by setting the environment variable TMPDIR.
EXAMPLE
To install Oracle(TM) 7 Standard Edition JDK, download a release - 64 bits version of update 2 from http://www.oracle.com/technet-
work/java/javase/downloads/jdk-7u2-download-1377129.html in this example - and invoke make-jpkg:
make-jpkg <path_to_download_directory>/jdk-7u2-linux-x64.tar.gz
This generate a Debian package in the current directory, that can be installed using dpkg:
dpkg -i oracle-j2sdk1.7_1.7.0+update2_amd64.deb
When you're done, you can delete initial download as well as generated package:
rm <path_to_download_directory>/jdk-7u2-linux-x64.tar.gz oracle-j2sdk1.7_1.7.0+update2_amd64.deb
ENVIRONMENT
TMPDIR base directory used for temporary files (defaults to /tmp)
J2SE_PACKAGE_FULL_NAME
full name used in the maintainer field of the package; if none is supplied then the default of "Debian Java Maintainers" is used.
J2SE_PACKAGE_EMAIL
email address used in the maintainer field of the package; if none is supplied the default of "pkg-java-maintain-
ers@lists.alioth.debian.org" is used.
SEE ALSO
update-java-alternatives(1)
AUTHOR
This manual page was written by Hubert Schmid <j2se-package@z42.de>.
It is now maintained by the Debian Java Maintainers <pkg-java-maintainers@lists.alioth.debian.org>.
January 22, 2012 MAKE-JPKG(1)