Sponsored Content
Top Forums Shell Programming and Scripting Display current directory for a running process for script Post 302910717 by seekryts15 on Sunday 27th of July 2014 04:00:08 PM
Old 07-27-2014
If theres a way where the user enters TEST which would be the working directory for pid 1390.
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

how to make a current running process ignore SIGHUP signal?

I ask this question since sometimes i run a time-consuming ftp in foreground and forget to use nohup ftp.sh & to put this work background and can still running after i log off. Assume this ftp task have run 1 hour, and still 1 hour time to end, i don't want to abort the ftp, first, i use ctrl+Z... (3 Replies)
Discussion started by: stevensxiao
3 Replies

2. Programming

to find current running process

Hi All, The scenario is like this: There is a process say "A" which create a child process say "B" if some condition is true and process "A" terminates. "B" invokes some C program say "C" using 'execl' function. The job of program "C" is to keep polling the server until the server will be up.... (2 Replies)
Discussion started by: ranjkuma692
2 Replies

3. Shell Programming and Scripting

current running process in shell

hi what is the shell programming code to know the number of processes currently running on the machine & information about those processes. Another one is the configuration and usage of the UNIX file system? requesting all for help. thanks (1 Reply)
Discussion started by: moco
1 Replies

4. UNIX for Dummies Questions & Answers

Current Process Running.

Hi all, When I issued command ps -ef|grep Vinay in a UNIX machine, I got the following Vinay 22491 1 255 Jun 18 ? 294248:53 -sh Vinay 26628 1 255 Jun 18 ? 294237:33 -sh Could you tell me what all process is running ? Please explain each of the fields. Thanks... (4 Replies)
Discussion started by: coolbhai
4 Replies

5. Shell Programming and Scripting

script to monitor process running on server and posting a mail if any process is dead

Hello all, I would be happy if any one could help me with a shell script that would determine all the processes running on a Unix server and post a mail if any of the process is not running or aborted. Thanks in advance Regards, pradeep kulkarni. :mad: (13 Replies)
Discussion started by: pradeepmacha
13 Replies

6. UNIX for Advanced & Expert Users

how to display pid and other parameters of current process through kernel module ?

how to display pid and other parameters of current process in linux platform ? i know it can be done through a linux commmand ps -F but i want it done through kernel program thanks in advance (1 Reply)
Discussion started by: vaibhavkorde
1 Replies

7. UNIX for Dummies Questions & Answers

Running different process from current process?

I have been having some trouble trying to get some code working, so I was wondering...what system calls are required to execute a different program from an already running process? (1 Reply)
Discussion started by: Midwest Product
1 Replies

8. Shell Programming and Scripting

Command to know all the Current running process and how to kill

All, 1.What is the unix comand used for all current running process (Including All current running processes Parent ->child->subchild process) 2.If child and subchild processes are running then what is the unix command to kill parent and its all child subchild processes in UNIX. Kindly... (7 Replies)
Discussion started by: skp
7 Replies

9. Shell Programming and Scripting

List Process running under current user

Hi, i need to list the processes running only under current logged in user. EX: $ whoami oraaqw $ ps -ef | grep tnslsnr oraaqw 11403300 19267592 0 09:14:47 pts/3 0:00 grep tnslsnr oraaqw 15794208 1 0 Jan 14 - 11:59... (6 Replies)
Discussion started by: aravindadla
6 Replies

10. UNIX for Beginners Questions & Answers

How to display only the first 5 running process using top in shell scripting?

topfunc() { top } topfunc Here i used the top command inside a function,and i called the function. when executing this bash file i get all the process which are using by the kernel i just want to display only the first 5 running process. is it possible? (7 Replies)
Discussion started by: Meeran Rizvi
7 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. If program is not given, then ``${SHELL}'' is run (default: /bin/sh). Enterable namespaces are: mount namespace Mounting and unmounting filesystems will not affect the rest of the system, except for filesystems which are explicitly marked as shared (with mount --make-shared; see /proc/self/mountinfo for the shared flag). For further details, see mount_namespaces(7) and the discussion of the CLONE_NEWNS flag in clone(2). UTS namespace Setting hostname or domainname will not affect the rest of the system. For further details, see namespaces(7) and the discussion of the CLONE_NEWUTS flag in clone(2). IPC namespace The process will have an independent namespace for POSIX message queues as well as System V message queues, semaphore sets and shared memory segments. For further details, see namespaces(7) and the discussion of the CLONE_NEWIPC flag in clone(2). network namespace The process will have independent IPv4 and IPv6 stacks, IP routing tables, firewall rules, the /proc/net and /sys/class/net direc- tory trees, sockets, etc. For further details, see namespaces(7) and the discussion of the CLONE_NEWNET flag in clone(2). PID namespace Children will have a set of PID to process mappings separate from the nsenter process For further details, see pid_namespaces(7) and the discussion of the CLONE_NEWPID flag in 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. user namespace The process will have a distinct set of UIDs, GIDs and capabilities. For further details, see user_namespaces(7) and the discussion of the CLONE_NEWUSER flag in clone(2). cgroup namespace The process will have a virtualized view of /proc/self/cgroup, and new cgroup mounts will be rooted at the namespace cgroup root. For further details, see cgroup_namespaces(7) and the discussion of the CLONE_NEWCGROUP flag in clone(2). See clone(2) for the exact semantics of the flags. OPTIONS
Various of the options below that relate to namespaces take an optional file argument. This should be one of the /proc/[pid]/ns/* files described in namespaces(7). -a, --all Enter all namespaces of the target process by the default /proc/[pid]/ns/* namespace paths. The default paths to the target process namespaces may be overwritten by namespace specific options (e.g. --all --mount=[path]). The user namespace will be ignored if the same as the caller's current user namespace. It prevents a caller that has dropped capa- bilities from regaining those capabilities via a call to setns(). See setns(2) for more details. -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/ns/user the user namespace /proc/pid/ns/cgroup the cgroup 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. -U, --user[=file] Enter the user namespace. If no file is specified, enter the user namespace of the target process. If file is specified, enter the user namespace specified by file. See also the --setuid and --setgid options. -C, --cgroup[=file] Enter the cgroup namespace. If no file is specified, enter the cgroup namespace of the target process. If file is specified, enter the cgroup namespace specified by file. -G, --setgid gid Set the group ID which will be used in the entered namespace and drop supplementary groups. nsenter(1) always sets GID for user namespaces, the default is 0. -S, --setuid uid Set the user ID which will be used in the entered namespace. nsenter(1) always sets UID for user namespaces, the default is 0. --preserve-credentials Don't modify UID and GID when enter user namespace. The default is to drops supplementary groups and sets GID and UID to 0. -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 directory 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, nsenter calls fork before calling exec so that any children will also be in the newly entered PID namespace. -Z, --follow-context Set the SELinux security context used for executing a new process according to already running process specified by --target PID. (The util-linux has to be compiled with SELinux support otherwise the option is unavailable.) -V, --version Display version information and exit. -h, --help Display help text and exit. SEE ALSO
clone(2), setns(2), namespaces(7) AUTHORS
Eric Biederman <biederm@xmission.com> Karel Zak <kzak@redhat.com> AVAILABILITY
The nsenter command is part of the util-linux package and is available from Linux Kernel Archive <https://www.kernel.org/pub/linux/utils /util-linux/>. util-linux June 2013 NSENTER(1)
All times are GMT -4. The time now is 07:18 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy