mirror of
https://github.com/gnustep/libs-ec.git
synced 2025-02-19 10:01:24 +00:00
Add support for restarting a process via API
This commit is contained in:
parent
d28d019bb5
commit
31b74e74c7
3 changed files with 34 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
|||
2022-11-14 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* EcProcess.h:
|
||||
* EcCommand.m:
|
||||
Add new method of Command server (-restart:reason:) to requst that
|
||||
it restart an individual process.
|
||||
|
||||
2022-11-11 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* EcCommand.m:
|
||||
|
|
20
EcCommand.m
20
EcCommand.m
|
@ -5928,6 +5928,26 @@ NSLog(@"Problem %@", localException);
|
|||
}
|
||||
}
|
||||
|
||||
- (BOOL) restart: (NSString*)name reason: (NSString*)reason
|
||||
{
|
||||
LaunchInfo *l = [LaunchInfo existing: name];
|
||||
|
||||
if (nil == l)
|
||||
{
|
||||
NSString *m;
|
||||
|
||||
m = [NSString stringWithFormat: cmdLogFormat(LT_CONSOLE,
|
||||
@"unrecognized name to restart %@"), name];
|
||||
[self information: m from: nil to: nil type: LT_CONSOLE];
|
||||
return NO;
|
||||
}
|
||||
else
|
||||
{
|
||||
[l restart: reason];
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (NSString*) makeSpace
|
||||
{
|
||||
NSInteger purgeAfter;
|
||||
|
|
|
@ -262,6 +262,12 @@ typedef enum {
|
|||
to: (NSString*)n
|
||||
from: (NSString*)c;
|
||||
|
||||
/** Request immediate restart of the named process.<br />
|
||||
* The reason string is displayed in reporting etc.<br />
|
||||
* Returns YES if the process was found, NO otherwise.
|
||||
*/
|
||||
- (BOOL) restart: (NSString*)name reason: (NSString*)reason;
|
||||
|
||||
/** Shut down the Command server and all its clients.<br />
|
||||
* Clients which fail to shut down gracefully before the specified timestamp
|
||||
* will be forcibly killed. The timestamp is constrained to be at least half
|
||||
|
@ -308,6 +314,7 @@ typedef enum {
|
|||
- (oneway void) reply: (NSString*)msg
|
||||
to: (NSString*)n
|
||||
from: (NSString*)c;
|
||||
- (BOOL) restart: (NSString*)name reason: (NSString*)reason;
|
||||
- (oneway void) servers: (in bycopy NSData*)a
|
||||
on: (id<Command>)s;
|
||||
- (oneway void) unmanage: (NSString*)name;
|
||||
|
|
Loading…
Reference in a new issue