ps command in scripts


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting ps command in scripts
# 8  
Old 03-30-2012
Quote:
Originally Posted by Corona688
That's not an ubuntu problem in particular, it ought to have the same version of ps as most other Linux. You may be in a chroot or otherwise restricted, unable to access that sort of information/

What does ls /proc do?
on CentOs:

Image


on Ubuntu
Image
# 9  
Old 03-31-2012
I don't mean from terminal. I mean from CGI.
# 10  
Old 03-31-2012
As the so called ubuntu output looks like being from a browser, this should work better:
Code:
#!/bin/bash
echo "content-type: text/html"
echo
echo "<pre>"
ps aux
echo "</pre>"

# 11  
Old 04-01-2012
Quote:
Originally Posted by Corona688
I don't mean from terminal. I mean from CGI.
CGI for all files: -rwxrwxrwx

---------- Post updated 04-01-12 at 01:49 AM ---------- Previous update was 03-31-12 at 07:28 PM ----------

Quote:
Originally Posted by jlliagre
As the so called ubuntu output looks like being from a browser, this should work better:
Code:
#!/bin/bash
echo "content-type: text/html"
echo
echo "<pre>"
ps aux
echo "</pre>"

you're true if using only one OC (in your case: Ubuntu). but i have to write scripts in CentOs and check it in Ubuntu. this cause a problem that i said aboveSmilie

Last edited by numeracy; 04-02-2012 at 02:56 AM..
# 12  
Old 04-02-2012
so, ls /proc from your cgi scripts on both OSes show -rwxrwxrwx, only -rwxrwxrwx, and absolutely nothing but -rwxrwxrwx ? Very strange.

Again, I think this has nothing to do with centos vs ubuntu, but the way these systems have been configured. You appear to have been denied access to ps either accidentally or intentionally.
# 13  
Old 04-02-2012
Quote:
Originally Posted by Corona688
so, ls /proc from your cgi scripts on both OSes show -rwxrwxrwx, only -rwxrwxrwx, and absolutely nothing but -rwxrwxrwx ? Very strange.

Again, I think this has nothing to do with centos vs ubuntu, but the way these systems have been configured. You appear to have been denied access to ps either accidentally or intentionally.
i just wrote ps script in CentOs Smilie
Image
# 14  
Old 04-02-2012
Off topic (maybe?). It is not advisable to call an executable script the same name as a system command. In this case ps .
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need equialent command for batch scripts

Hi Friend, what is the equivalent command for batch scripting of tail -1. for example : i have a.txt file with below the contents. i need to print last line --------------------------------- Use descriptive thread titles when posting. For example, do not post questions with subjects like... (3 Replies)
Discussion started by: Jewel
3 Replies

2. Shell Programming and Scripting

Command need to be used for the scripts output differences

Hi All, Actually we want to know the command need to use if the difference between two files are null, then it should not send as mail. Oterwise it should send as mail alert. Below for your reference, # Email the spoolfile. diff free_sp_new.log free_sp_old.log if output of above... (1 Reply)
Discussion started by: thanvir.akram
1 Replies

3. Shell Programming and Scripting

Running Two scripts in a single command line

Hi All, I have two scripts which i want to run in a single command line(or in a single script). And if both the scripts in the main script fail then i want to pass a value to a Application specific utility which will trigger some alert.The value can be anything. Somebody please help.It is... (1 Reply)
Discussion started by: shroh
1 Replies

4. Shell Programming and Scripting

set only some command & scripts permission to a particular user

hi, i am new in unix.......i am using bash and i want to create a user which has only some command and scripts permission.........is it possible? thanx (1 Reply)
Discussion started by: rakeshtomar82
1 Replies

5. Shell Programming and Scripting

Running shell scripts from command

I have written a few shellscripts to run a videogame (starcraft) at different patched versions. For example bw113 runs the 1.13 version of the game. These works perfectly when I run them from command line (./bw113). However I cannot get it to work via mouseclick. Some Information: - I have... (5 Replies)
Discussion started by: lordsloth
5 Replies

6. Shell Programming and Scripting

Invoking 2 scripts in 1 command

HI, I have 2 scripts main.sh and sub.sh, I want to invoke both these scripts in 1 unix command.. Something like... csh -f main.sh(sub.sh TIBCO) sub.sh returns a value as .., by taking this value main.sh prints a text. Can anyone help me to build this command Below are the scripts ////sub.sh... (3 Replies)
Discussion started by: bce_groups
3 Replies

7. UNIX for Dummies Questions & Answers

how to write perl substitute command in shell scripts

How to write perl substitute command in shell script without invoking a perl script file seperately. for ex: shell script to relace IT with CSC in a file using perl substitute command. (3 Replies)
Discussion started by: param_it
3 Replies

8. Shell Programming and Scripting

what's the debug command for perl scripts

Hi, Can you please let me know if there's any debug command for perl scripts like set -x for shell scripts (2 Replies)
Discussion started by: dayanandra
2 Replies

9. Shell Programming and Scripting

BUILT-IN command scripts

I am new to Unix scripting. I would like to know if someone can point me to a site which lists any built-in commands in there scripted form. I thought to start with the basics and learn from example. Thanks JSP (2 Replies)
Discussion started by: JSP
2 Replies

10. UNIX for Advanced & Expert Users

sqlplus and sh scripts (to_char command))

Hi evrybody!!!! I have a problem with this shell script INICIO=$(sqlplus -s user/user@db1 << END | awk '{printf $1}' set head off set feed off select to_char(min(create_dt) , 'HH24') from table_name where trunc(create_dt)=trunc(sysdate-2); END) I want to recover, in INICIO, the min... (4 Replies)
Discussion started by: josecollantes
4 Replies
Login or Register to Ask a Question