LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-02-2006, 08:11 AM   #1
mike81
LQ Newbie
 
Registered: Aug 2006
Posts: 9

Rep: Reputation: 0
Script help !!!!!


i would like to make a script that when i type this command ps -ef |grep oraweb ... i want the script to kill all the process that command will show ... any idea please ?

Script need to do.
-----------------------

su - oraweb
owsctl stop
owsctl stop -nodemgr
exit

ps -ef |grep oraweb

kill -9 15620 ( Process number change so it can't be kill -9 ..... static)
kill -9 .....

su - oraweb
owsctl start -nodemgr &
owsctl start
 
Old 08-02-2006, 08:35 AM   #2
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,761

Rep: Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587
You can use either:
Code:
killall oraweb
pkill oraweb
 
Old 08-02-2006, 09:04 AM   #3
mike81
LQ Newbie
 
Registered: Aug 2006
Posts: 9

Original Poster
Rep: Reputation: 0
Thanks

Will try as soon as i can :P i need to start writing the script :P never did that before so im looking for information on google !!!

Thanks alot ... very apreciated
 
Old 08-02-2006, 09:15 AM   #4
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,761

Rep: Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587
If you want to use a script, use this:
Code:
#!/bin/sh
kill -9 `pgrep oraweb`
 
Old 08-02-2006, 09:37 AM   #5
mike81
LQ Newbie
 
Registered: Aug 2006
Posts: 9

Original Poster
Rep: Reputation: 0
So that shoud do the job !!! ????? Thanks again !! :P

#!/bin/sh
su - oraweb
owsctl stop
owsctl stop -nodemgr
exit

kill -9 `pgrep oraweb`

su - oraweb
owsctl start -nodemgr &
owsctl start
 
Old 08-02-2006, 09:47 AM   #6
mike81
LQ Newbie
 
Registered: Aug 2006
Posts: 9

Original Poster
Rep: Reputation: 0
Look like the script stop right after the first su - oraweb
 
Old 08-02-2006, 04:40 PM   #7
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 11,761

Rep: Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587Reputation: 1587
Try this instead:
Code:
#!/bin/sh
su - oraweb -c owsctl stop
su - oraweb -c owsctl stop -nodemgr
kill -9 `pgrep oraweb`
su - oraweb -c owsctl start -nodemgr &
su - oraweb -c owsctl start
Make sure that the user's oraweb environment is setup correctly, i.e the user can run the commands (owsctl stop, owsctl start etc) directly, without specifying the full path to the command.
 
Old 08-02-2006, 05:03 PM   #8
spirit receiver
Member
 
Registered: May 2006
Location: Frankfurt, Germany
Distribution: SUSE 10.2
Posts: 424

Rep: Reputation: 33
Here's another option:
Code:
su - oraweb << EOF
owsctl stop
owsctl stop -nodemgr
EOF
kill [...]
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Iptables (with masq) troubleshooting, very simple script attached script and logs. xinu Linux - Networking 13 11-01-2007 04:19 AM
How to start a Tcl/Tk script by simply invoking the script file itself ? cyu021 Programming 2 10-10-2004 11:00 AM
creating shell script that executes as root regardless of who runs the script? m3kgt Linux - General 13 06-04-2004 10:23 PM
send automatic input to a script called by another script in bash programming jorgecab Programming 2 04-01-2004 12:20 AM
linux 9 and java script error - premature end of script header sibil Linux - Newbie 0 01-06-2004 04:21 PM


All times are GMT -5. The time now is 08:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration