10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello,
I want to save pid of a child process but I get empty file.
su myuser -c "nohup ./mydaemon.sh >/dev/null 2>&1 & print $! > mydaemon.pid"
This one works:
nohup ./mydaemon.sh >/dev/null 2>&1 & print $! > mydaemon.pid
Please help. Thank you in advance. (2 Replies)
Discussion started by: vincegata
2 Replies
2. Shell Programming and Scripting
Hello,
I would like to know what this command means?
PID=$!
what does "!" stand for? (5 Replies)
Discussion started by: googlietdr
5 Replies
3. UNIX for Advanced & Expert Users
Besides doing some shell-script which loops through /etc/passwd, I was wondering if there was some command that would tell me, like an enhanced version of getent.
The Operating system is Solaris 10 (recent-ish revision) using Sun DS for LDAP. (5 Replies)
Discussion started by: ckmehta
5 Replies
4. UNIX for Dummies Questions & Answers
Hello people,
This question might seem to be a little naive but here it goes:
I want to know the PID of a script that is running in the background.
eg: There is a script called Data_Downloader.sh
I am using the command:
ps -ef | grep Data_Downloader.sh
But I am getting the output as
wrkarea... (9 Replies)
Discussion started by: Rajat
9 Replies
5. UNIX for Dummies Questions & Answers
Hi,
I need to get the pid of a process and have to store the pid in a variable and i want to use this value(pid) of the variable for some process. Please can anyone tell me how to get the pid of a process and store it in a variable. please help me on this.
Thanks in advance,
Amudha (7 Replies)
Discussion started by: samudha
7 Replies
6. Shell Programming and Scripting
Hi All,
In my project i have two process runs in the back end.
Once i start my project, and execute the command ps, i get below output:
PID TTY TIME CMD
9086 pts/1 0:00 ksh
9241 pts/1 0:02 java
9240 pts/1 0:00 shell_script_bg
java with 9241 PID is the main... (4 Replies)
Discussion started by: rkrgarlapati
4 Replies
7. UNIX for Dummies Questions & Answers
1. If I use an software application(which connects to the database in the server) in my local pc, how many PID should be registered? Would there be PID for the session and another PID for socket connection?
2. I noticed (through netstat) that when I logged in using the my software application,... (1 Reply)
Discussion started by: pcx26
1 Replies
8. UNIX for Dummies Questions & Answers
Hi ,
I am trying to get the PID using the following command:
$ /usr/ucb/ps -auwwwwx | grep java | grep Proceess | ptree PID or
$ /usr/ucb/ps -auwwwwx | grep java | grep Proceess;ptree PID
it is possible to get PID, such that I check whether any orphan
process is running.
solution... (0 Replies)
Discussion started by: Rakesh Bhat
0 Replies
9. UNIX for Advanced & Expert Users
What OS does not use PID=0? is it FreeBSD? (0 Replies)
Discussion started by: nmajin
0 Replies
10. Programming
question: for the below program
i just printed the value for pid, child pid and parent pid
why does it give me 6 values? i assume ppid is 28086
but can't figure out why there are 5 values printed instead of just two!
can someone comment on that!
#include<stdio.h>
#define DIM 8
int... (3 Replies)
Discussion started by: a25khan
3 Replies
NSENTER(1) User Commands NSENTER(1)
NAME
nsenter - run program with namespaces of other processes
SYNOPSIS
nsenter [options] [program] [arguments]
DESCRIPTION
Enters the namespaces of one or more other processes and then executes the specified program. Enterable namespaces are:
mount namespace
mounting and unmounting filesystems will not affect rest of the system (CLONE_NEWNS flag), except for filesystems which are explic-
itly marked as shared (by mount --make-shared). See /proc/self/mountinfo for the shared flag.
UTS namespace
setting hostname, domainname will not affect rest of the system (CLONE_NEWUTS flag).
IPC namespace
process will have independent namespace for System V message queues, semaphore sets and shared memory segments (CLONE_NEWIPC flag).
network namespace
process will have independent IPv4 and IPv6 stacks, IP routing tables, firewall rules, the /proc/net and /sys/class/net directory
trees, sockets etc. (CLONE_NEWNET flag).
PID namespace
children will have a set of PID to process mappings separate from the nsenter process (CLONE_NEWPID flag). nsenter will fork by
default if changing the PID namespace, so that the new program and its children share the same PID namespace and are visible to each
other. If --no-fork is used, the new program will be exec'ed without forking.
See the clone(2) for exact semantics of the flags.
If program is not given, run ``${SHELL}'' (default: /bin/sh).
OPTIONS
Argument with square brakets, such as [file], means optional argument. Command line syntax to specify optional argument --mount=/path/to
/file. Please notice the equals sign.
-t, --target pid
Specify a target process to get contexts from. The paths to the contexts specified by pid are:
/proc/pid/ns/mnt the mount namespace
/proc/pid/ns/uts the UTS namespace
/proc/pid/ns/ipc the IPC namespace
/proc/pid/ns/net the network namespace
/proc/pid/ns/pid the PID namespace
/proc/pid/root the root directory
/proc/pid/cwd the working directory respectively
-m, --mount [file]
Enter the mount namespace. If no file is specified enter the mount namespace of the target process. If file is specified enter the
mount namespace specified by file.
-u, --uts [file]
Enter the UTS namespace. If no file is specified enter the UTS namespace of the target process. If file is specified enter the UTS
namespace specified by file.
-i, --ipc [file]
Enter the IPC namespace. If no file is specified enter the IPC namespace of the target process. If file is specified enter the IPC
namespace specified by file.
-n, --net [file]
Enter the network namespace. If no file is specified enter the network namespace of the target process. If file is specified enter
the network namespace specified by file.
-p, --pid [file]
Enter the PID namespace. If no file is specified enter the PID namespace of the target process. If file is specified enter the PID
namespace specified by file.
-r, --root [directory]
Set the root directory. If no directory is specified set the root directory to the root directory of the target process. If direc-
tory is specified set the root directory to the specified directory.
-w, --wd [directory]
Set the working directory. If no directory is specified set the working directory to the working directory of the target process.
If directory is specified set the working directory to the specified directory.
-F, --no-fork
Do not fork before exec'ing the specified program. By default when entering a pid namespace enter calls fork before calling exec so
that the children will be in the newly entered pid namespace.
-V, --version
Display version information and exit.
-h, --help
Print a help message.
SEE ALSO
setns(2), clone(2)
AUTHOR
Eric Biederman <ebiederm@xmission.com>
AVAILABILITY
The nsenter command is part of the util-linux package and is available from Linux Kernel Archive <ftp://ftp.kernel.org/pub/linux/utils
/util-linux/>.
util-linux January 2013 NSENTER(1)