Sponsored Content
Top Forums Shell Programming and Scripting Switch User in within a Shell Script Post 302466951 by Afi_Linux on Wednesday 27th of October 2010 07:25:28 PM
Old 10-27-2010
Is the following command will show up in a logs if [X]YZ is running? The actual ouput of ps -ef |grep XYZ ?

I want to kill it if running. I'm assuming that the commad "{print $2}" print the PID of the XYZ process and kill it.

Thanks,
Afi
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

switch user inside a script

Hi, I wrote a unix script that will perform differnt tasks on bahalf of number of users. I use "sudo" to run the script. The problem is when I execute the command: su - user -c "xxx " > output_file, I get the system output header frm the su command. Is there a way to get rid of it instdead of... (2 Replies)
Discussion started by: nimo
2 Replies

2. Shell Programming and Scripting

switch user inside a script

Hi Is there any way to switch user inside a shell script? (4 Replies)
Discussion started by: ./hari.sh
4 Replies

3. Shell Programming and Scripting

How to switch user in shell scripting (without sudo)?

Hi everyone: I have a big trouble, I need create a script that must switch user and then must execute certain commands, sadly neither my user nor the second user have no privileges for sudo, I've tried everything but seems su doesn't accept input redirection, please help me, it's very... (8 Replies)
Discussion started by: edgarvm
8 Replies

4. Shell Programming and Scripting

Switch user inside shell script

Hi, I am trying to create one script where I have to login as another user inside the script to exeute some commands How can i achieve this? Many thanks in advance. (4 Replies)
Discussion started by: prarat
4 Replies

5. Shell Programming and Scripting

How to switch user using shell script ?

Hi, script1.sh script2.sh script3.sh From above, script1.sh is the main script which is executed from root user, creates installation directory, changing ownership and execution rights etc..etc.. and finally calls scripot2.sh and script3.sh to create the database as well as for post... (1 Reply)
Discussion started by: milink
1 Replies

6. UNIX for Dummies Questions & Answers

How to switch the user before executing a shell script from web page??

hi, i want to execute a shell script as a different user. the flow is like this. there is a html web page from which i have to call a shell script. web server is apache. to call the shell script from html page, a perl script is required. so the html page calls the perl script and the perl... (2 Replies)
Discussion started by: Little
2 Replies

7. Shell Programming and Scripting

Switch user without password inside shell

I want to switch to another user without password inside shell. I used the below command and it is not working. sudo su - user1 user1 is not in the sudoers file. This incident will be reported. I'm getting the above message. If I want to add user1 into the sudoers file using... (5 Replies)
Discussion started by: Roozo
5 Replies

8. Shell Programming and Scripting

How to switch user in shell scripting (without root)?

Hi everyone: I need create a script that must switch user and then must execute certain commands, sadly neither my user nor the second user have no privileges for su - , I've tried everything but seems su doesn't accept input redirection, please help me, ... (4 Replies)
Discussion started by: ooilinlove
4 Replies

9. Shell Programming and Scripting

How to Switch from Local user to root user from a shell script?

Hi, I need to switch from local user to root user in a shell script. I need to make it automated so that it doesn't prompt for the root password. I heard the su command will do that work but it prompt for the password. and also can someone tell me whether su command spawns a new shell or... (1 Reply)
Discussion started by: Little
1 Replies

10. UNIX for Beginners Questions & Answers

How to switch user in shell script?

HI in a server we can't login with root user directly but i can login with different user and then i can switch to root user by su command Requirement is there anyway where i can write a script without mentioning password in file as mentioning the root password is not the... (3 Replies)
Discussion started by: scriptor
3 Replies
KILL(1) 							   User Commands							   KILL(1)

NAME
kill - send signals to processes, or list signals SYNOPSIS
kill [-s SIGNAL | -SIGNAL] PID... kill -l [SIGNAL]... kill -t [SIGNAL]... DESCRIPTION
Send signals to processes, or list signals. Mandatory arguments to long options are mandatory for short options too. -s, --signal=SIGNAL, -SIGNAL specify the name or number of the signal to be sent -l, --list list signal names, or convert signal names to/from numbers -t, --table print a table of signal information --help display this help and exit --version output version information and exit SIGNAL may be a signal name like `HUP', or a signal number like `1', or the exit status of a process terminated by a signal. PID is an integer; if negative it identifies a process group. NOTE: your shell may have its own version of kill, which usually supersedes the version described here. Please refer to your shell's docu- mentation for details about the options it supports. AUTHOR
Written by Paul Eggert. REPORTING BUGS
Report kill bugs to bug-coreutils@gnu.org GNU coreutils home page: <http://www.gnu.org/software/coreutils/> General help using GNU software: <http://www.gnu.org/gethelp/> COPYRIGHT
Copyright (C) 2009 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
kill(2) The full documentation for kill is maintained as a Texinfo manual. If the info and kill programs are properly installed at your site, the command info coreutils 'kill invocation' should give you access to the complete manual. GNU coreutils 7.1 July 2010 KILL(1)
All times are GMT -4. The time now is 06:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy