04-28-2008
firstname.surname firstname.surname firstname.surname
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi All,
I am trying to write a script to list all users and their processes. I cant seem to find out how to link the PID to the user. For example if i run ps -a I get a nice list of all the processes running and their PID, but no information about which user is running them.
If i use w i... (17 Replies)
Discussion started by: Chiefos
17 Replies
2. Shell Programming and Scripting
Hi guys,
I'm writing a script to display all the current logged on users and the processes they're running, output to a file. The output will look similar to this:
User1 (Real name not login name)
PID TTY TIME CMD
3179 pts/3 00:00:00 vim
User2
PID TTY TIME ... (2 Replies)
Discussion started by: olimiles
2 Replies
3. Shell Programming and Scripting
hello, i am VERY new to this whole script world. I need to come up with a script that will email a user if they have an idle process past 500 minutes...any suggestions??? Thanks so much. (0 Replies)
Discussion started by: sheppy28
0 Replies
4. UNIX for Dummies Questions & Answers
I am trying to write a script to list all users and their processes. I cant seem to find out how to link the PID to the user. For example if i run ps -a I get a nice list of all the processes running and their PID, but no information about which user is running them. I need the users real name not... (3 Replies)
Discussion started by: iago
3 Replies
5. Shell Programming and Scripting
Thx for all the help so far, I really appreciate it, this is the last task I have to do then I am no longer a trainee ^^, which means I can use whatever utility I want. :O
I need to write a script that does more or less what is shown below.
The Users Name
PID TTY TIME CMD
12345 pts/3... (22 Replies)
Discussion started by: barbus
22 Replies
6. Programming
Hello All,
Background
========
I am creating a virtual appliance console for a software stack on VMware ESXi. I am using Centos 5.x as the Linux distro (Guest OS). I have created a ncurses based application that does the user authentication and present him with some basic controls to do basic... (2 Replies)
Discussion started by: ku@ntum
2 Replies
7. Shell Programming and Scripting
Hello,
What i have to do is make a top 10 list of users sorted by the number of processes opened at a given time. Can anyone help me with finding out for a given moment, for all users how many processes each had opened? (5 Replies)
Discussion started by: gabibyte
5 Replies
8. Shell Programming and Scripting
Is it possible to get a list of users sorted by the number of processes executed by each.
I have a HP - UX server with 2800 processes running currently.
And I want to know the number of processes owned by each person logged in to that server.something like below:
user1 : 150 Processes
user2 :... (2 Replies)
Discussion started by: engineer
2 Replies
9. UNIX for Dummies Questions & Answers
hello,
i need help with something which should be fairly simple but i am having a little trouble.
i need to list all the processes on the system but also need the parent id.
so the following does not print parent id.
ps -A or ps -e.
i searched manual and saw an option
--ppid
so i... (2 Replies)
Discussion started by: iluvsushi
2 Replies
10. Homework & Coursework Questions
I would like to get an opinion for my solution for this task and get feedback about better approach or mistakes I have made.
1. The problem statement, all variables and given/known data:
The task is to create a script which prints information about users whose names are specified in the... (2 Replies)
Discussion started by: kornfan
2 Replies
LEARN ABOUT PHP
cubrid_query
CUBRID_QUERY(3) 1 CUBRID_QUERY(3)
cubrid_query - Send a CUBRID query
SYNOPSIS
resource cubrid_query (string $query, [resource $conn_identifier])
DESCRIPTION
cubrid_query(3) sends a unique query (multiple queries are not supported) to the currently active database on the server that's associated
with the specified $conn_identifier.
PARAMETERS
o $query
- An SQL query Data inside the query should be properly escaped.
o $conn_identifier
- The CUBRID connection. If the connection identifier is not specified, the last connection opened by cubrid_connect(3) is
assumed.
RETURN VALUES
For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, cubrid_query(3) returns a resource on success, or FALSE on
error.
For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, cubrid_query(3) returns TRUE on success or FALSE on error.
The returned result resource should be passed to cubrid_fetch_array(3), and other functions for dealing with result tables, to access the
returned data.
Use cubrid_num_rows(3) to find out how many rows were returned for a SELECT statement or cubrid_affected_rows(3) to find out how many rows
were affected by a DELETE, INSERT, REPLACE, or UPDATE statement.
cubrid_query(3) will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query.
EXAMPLES
Example #1
Invalid Query
The following query is syntactically invalid, so cubrid_query(3) fails and returns FALSE.
<?php
$conn = cubrid_connect('localhost', 33000, 'demodb');
$result = cubrid_query('SELECT * WHERE 1=1');
if (!$result) {
die('Invalid query: ' . cubrid_error());
}
?>
Example #2
Valid Query
The following query is valid, so cubrid_query(3) returns a resource.
<?php
// This could be supplied by a user, for example
$firstname = 'fred';
$lastname = 'fox';
$conn = cubrid_connect('localhost', 33000, 'demodb');
cubrid_execute($conn,"DROP TABLE if exists friends");
cubrid_execute($conn,"create table friends(firstname varchar,lastname varchar,address char(24),age int)");
cubrid_execute($conn,"insert into friends values('fred','fox','home-1','20')");
cubrid_execute($conn,"insert into friends values('blue','cat','home-2','21')");
// Formulate Query
// This is the best way to perform an SQL query
// For more examples, see cubrid_real_escape_string()
$query = sprintf("SELECT firstname, lastname, address, age FROM friends WHERE firstname='%s' AND lastname='%s'",
cubrid_real_escape_string($firstname),
cubrid_real_escape_string($lastname));
// Perform Query
$result = cubrid_query($query);
// Check result
// This shows the actual query sent to CUBRID, and the error. Useful for debugging.
if (!$result) {
$message = 'Invalid query: ' . cubrid_error() . "
";
$message .= 'Whole query: ' . $query;
die($message);
}
// Use result
// Attempting to print $result won't allow access to information in the resource
// One of the cubrid result functions must be used
// See also cubrid_result(), cubrid_fetch_array(), cubrid_fetch_row(), etc.
while ($row = cubrid_fetch_assoc($result)) {
echo $row['firstname'];
echo $row['lastname'];
echo $row['address'];
echo $row['age'];
}
// Free the resources associated with the result set
// This is done automatically at the end of the script
cubrid_free_result($result);
?>
SEE ALSO
cubrid_connect(3), cubrid_error(3), cubrid_real_escape_string(3), cubrid_result(3), cubrid_fetch_assoc(3), cubrid_unbuffered_query(3).
PHP Documentation Group CUBRID_QUERY(3)