Could somebody give me some suggestions on how to write a safe shell
script to kill remote processes?
Two Solaris 2.5.1 SPARCstation (A and B) on a common Ethernet. Remote
accesses (each other) through rlogin and X protocol are allowed. A is
used as a software server, and running other real-time control
processes, really critical. We rlogin to A from B, start applications
for B with "-display B:0.0" argument.
Now I'd like a safe, conservative shell script to rlogin to A and kill
those processes started for B, then restart them again. Other processes
on A are too important to be killed by mistake. Is it okay to "grep"
"ps"'s output, then "sed" for process names with "-display B:0.0"?
Wei
|
|
0
|
|
|
|
Reply
|
leethium (1)
|
9/17/2005 8:12:29 AM |
|
Wei wrote:
> [...]
> Two Solaris 2.5.1 SPARCstation (A and B) on a common Ethernet. Remote
> accesses (each other) through rlogin and X protocol are allowed. A is
> used as a software server, and running other real-time control
> processes, really critical. We rlogin to A from B, start applications
> for B with "-display B:0.0" argument.
> [...]
Solaris 2.5.1 support ends next thursday (EOSL 09/22/05), I wouldn't run
"really critical" processes on that platform.
|
|
0
|
|
|
|
Reply
|
Jean
|
9/17/2005 12:53:21 PM
|
|
Thanks for your reminder, but that's sort of something I can't control.
: (
I'm not familiar with Solaris. Hence, not sure about the differences of
process system and tools (eg. sed, ps, ...) between Solaris and
GNU/Linux. Any place that should be paid special attention to when
writing such a process killing script?
|
|
0
|
|
|
|
Reply
|
Wei
|
9/18/2005 12:17:13 AM
|
|
Wei wrote:
> Thanks for your reminder, but that's sort of something I can't control.
> : (
>
> I'm not familiar with Solaris. Hence, not sure about the differences of
> process system and tools (eg. sed, ps, ...) between Solaris and
> GNU/Linux. Any place that should be paid special attention to when
> writing such a process killing script?
>
The issue is not here Gnu utilities vs Solaris, the issue is Solaris
2.5.1, which (probably?) lacks commands that would be used on current
Solaris releases, like pgrep or pkill.
|
|
0
|
|
|
|
Reply
|
Jean
|
9/18/2005 8:00:06 AM
|
|
Yes, you're right. There's no pkill or pgrep in Solaris 2.5.1. Given
the fact that I can't upgrade the OS, is it possible to implement
similar functionalities with shell scripts? (Or other commands?)
|
|
0
|
|
|
|
Reply
|
Wei
|
9/18/2005 8:45:43 AM
|
|
HI,
Jean-Louis Liagre wrote:
> Wei wrote:
>
>> [...]
>> Two Solaris 2.5.1 SPARCstation (A and B) on a common Ethernet. Remote
>> accesses (each other) through rlogin and X protocol are allowed. A is
>> used as a software server, and running other real-time control
>> processes, really critical. We rlogin to A from B, start applications
>> for B with "-display B:0.0" argument.
>> [...]
>
>
> Solaris 2.5.1 support ends next thursday (EOSL 09/22/05), I wouldn't run
> "really critical" processes on that platform.
On the other hand, since it's been around for 9-10 years, I would prefer
2.5.1 compared to S9/S10 on a critical system :)
/michael
|
|
0
|
|
|
|
Reply
|
Michael
|
9/18/2005 1:58:16 PM
|
|
HI,
Wei wrote:
> Could somebody give me some suggestions on how to write a safe shell
> script to kill remote processes?
>
> Two Solaris 2.5.1 SPARCstation (A and B) on a common Ethernet. Remote
> accesses (each other) through rlogin and X protocol are allowed. A is
> used as a software server, and running other real-time control
> processes, really critical. We rlogin to A from B, start applications
> for B with "-display B:0.0" argument.
>
> Now I'd like a safe, conservative shell script to rlogin to A and kill
> those processes started for B, then restart them again. Other processes
> on A are too important to be killed by mistake. Is it okay to "grep"
> "ps"'s output, then "sed" for process names with "-display B:0.0"?
>
> Wei
>
Not at all any PRO in this but would it help to store the PID of the
started process(s) for later use when running kill -9/15 on that PID?
This way you would keep track of all started processes.
/michael
|
|
0
|
|
|
|
Reply
|
Michael
|
9/18/2005 2:02:20 PM
|
|
Wei wrote:
> Yes, you're right. There's no pkill or pgrep in Solaris 2.5.1. Given
> the fact that I can't upgrade the OS, is it possible to implement
> similar functionalities with shell scripts? (Or other commands?)
>
pgrep/pkill code is actually open source now:
http://cvs.opensolaris.org/source/xref/usr/src/cmd/pgrep/
I've no idea about if this source will directly compile
on 2.5.1 or if some porting effort would be required though.
|
|
0
|
|
|
|
Reply
|
Jean
|
9/18/2005 3:09:53 PM
|
|
Michael Laajanen wrote:
> HI,
>
> Wei wrote:
>
>> Could somebody give me some suggestions on how to write a safe shell
>> script to kill remote processes?
>>
>> Two Solaris 2.5.1 SPARCstation (A and B) on a common Ethernet. Remote
>> accesses (each other) through rlogin and X protocol are allowed. A is
>> used as a software server, and running other real-time control
>> processes, really critical. We rlogin to A from B, start applications
>> for B with "-display B:0.0" argument.
>>
>> Now I'd like a safe, conservative shell script to rlogin to A and kill
>> those processes started for B, then restart them again. Other processes
>> on A are too important to be killed by mistake. Is it okay to "grep"
>> "ps"'s output, then "sed" for process names with "-display B:0.0"?
>>
>> Wei
>>
> Not at all any PRO in this but would it help to store the PID of the
> started process(s) for later use when running kill -9/15 on that PID?
>
> This way you would keep track of all started processes.
>
> /michael
>
That would be the best way but, not having that,
the PID you can get with
ps -ef |grep <string> |grep -v grep |awk '{print $2}'
I would test the script using "echo" instead of "kill" (maybe redirected
to a file or something)
|
|
0
|
|
|
|
Reply
|
Jaime
|
9/25/2005 2:42:01 PM
|
|
Jaime Cardoso <jaimec@solsuni.pt> writes:
> That would be the best way but, not having that,
> the PID you can get with
> ps -ef |grep <string> |grep -v grep |awk '{print $2}'
> I would test the script using "echo" instead of "kill" (maybe redirected to
> a file or something)
Or use pkill(1). It's Solaris, after all.
Bye, Dragan
--
Dragan Cvetkovic,
To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer
!!! Sender/From address is bogus. Use reply-to one !!!
|
|
0
|
|
|
|
Reply
|
Dragan
|
9/27/2005 7:06:54 PM
|
|
Dragan Cvetkovic <me@privacy.net> writes:
> Jaime Cardoso <jaimec@solsuni.pt> writes:
>
>> That would be the best way but, not having that,
>> the PID you can get with
>> ps -ef |grep <string> |grep -v grep |awk '{print $2}'
>> I would test the script using "echo" instead of "kill" (maybe redirected to
>> a file or something)
>
> Or use pkill(1). It's Solaris, after all.
>
Never mind pkill. Didn't notice OP was talking about Solaris 2.5.1
Dragan
--
Dragan Cvetkovic,
To be or not to be is true. G. Boole No it isn't. L. E. J. Brouwer
!!! Sender/From address is bogus. Use reply-to one !!!
|
|
0
|
|
|
|
Reply
|
Dragan
|
9/27/2005 7:07:54 PM
|
|
Thanks for all of you! And to Jaime: yeah, your grep with -v argument
is exactly what I want to simplify my original script. I'm too silly to
overlook it. Thank you!
|
|
0
|
|
|
|
Reply
|
Wei
|
9/29/2005 1:12:35 PM
|
|
|
11 Replies
628 Views
(page loaded in 8.235 seconds)
Similiar Articles: Safe script to kill processes - comp.unix.solarisCould somebody give me some suggestions on how to write a safe shell script to kill remote processes? Two Solaris 2.5.1 SPARCstation (A and B) on a c... full list of processes running in AIX - comp.unix.programmer ...how to get the status from scripts running in the background ... full list of processes running in AIX - comp.unix.programmer ... Safe script to kill processes - comp.unix ... Hung processes - comp.databases.mysqlSafe script to kill processes - comp.unix.solaris Checking for hung processes or time limit exceeded? - comp.unix ... Depending on the criteria, they kill a process that ... need to kill worker process in parfor loop - comp.soft-sys.matlab ...Safe script to kill processes - comp.unix.solaris need to kill worker process in parfor loop - comp.soft-sys.matlab ... If the time exceeds, lets say, 500 seconds, it ... exit and kill background jobs? - comp.unix.solarisSafe script to kill processes ... Web ... shell, set it to run off in the background and ... sessions" or "jobs ... retrieving exit status from background processes - The ... How to early exit a script - comp.soft-sys.matlabSafe script to kill processes - comp.unix.solaris How to early exit a script - comp.soft-sys.matlab Safe script to kill processes - comp.unix.solaris How to early exit a ... Question about noexec_user_stack and Oracle - comp.sys.sun.admin ...Safe script to kill processes - comp.unix.solaris Safe script to kill processes - comp.unix.solaris Question about noexec_user_stack and Oracle - comp.sys.sun.admin ... Solaris SIGSEGV signal handlers - comp.unix.programmerSafe script to kill processes - comp.unix.solaris Solaris SIGSEGV signal handlers - comp.unix.programmer... unix.programmer ... of a select few signals to the process ... expect SIGSEGV on Linux - comp.lang.tclSafe script to kill processes - comp.unix.solaris... eg. sed, ps, ...) between Solaris and > GNU/Linux. ... Solaris SIGSEGV signal handlers - comp.unix.programmer ... but ... kill all the child processes - comp.unix.programmerSafe script to kill processes - comp.unix.solaris Getting the PID of a process ID - comp.os.linux.misc kill all the child processes - comp.unix.programmer can any one give ... Examples of C++ in Safety Critical Systems - comp.lang.c++ ...Safe script to kill processes - comp.unix.solaris Safe script to kill processes - comp.unix.solaris Examples of C++ in Safety Critical Systems - comp.lang.c++ ... How does a scrpt find its process id when under cron ? - comp.unix ...kill all the child processes - comp.unix.programmer... one give me the unix shell script to kill all the child processes if a parent process id ... fork(): how can I kill forked process and all ITS children, but ...fork(): how can I kill forked process and all ITS children, but leave parent alive? ... then lets say calls "xterm &", after the timeout has occurred, I kill the shell script ... how to kill all the children of a process - comp.unix.programmer ...Safe script to kill processes - comp.unix.solaris how to kill all the children of a process - comp.unix.programmer ... kill all the child processes - comp.unix.programmer ... How to get the child process pid ? - comp.unix.adminkill all the child processes - comp.unix.programmer can any one give me the unix shell script to kill all the child processes if a parent process id is given. Safe script to kill processes - comp.unix.solaris | Computer GroupCould somebody give me some suggestions on how to write a safe shell script to kill remote processes? Two Solaris 2.5.1 SPARCstation (A and B) on a c... Safe to kill all user: 'nobody' processes? - LinuxQuestions.orgIs it safe to kill all processes which have the user: "nobody"? I set up a firewall ... shell script to kill all processes on specified port: varunbihani: Linux - General 7/24/2012 2:20:14 PM
|