From: Cristiano Giuffrida Date: Mon, 27 Oct 2014 21:36:25 +0000 (+0100) Subject: rs: New RS. X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=refs%2Fchanges%2F99%2F3099%2F2;p=minix.git rs: New RS. Change-Id: I46e335d5dac49104028d7cb0706b3e85de752bfe --- diff --git a/etc/rs.inet b/etc/rs.inet index 5bd9d6b70..448915d7d 100755 --- a/etc/rs.inet +++ b/etc/rs.inet @@ -55,6 +55,8 @@ disabled() exec > /dev/console echo "Arguments: $@" +restarts=$(grep restarts /proc/service/$1 |cut -d: -f2) +restarts=$(( $restarts + 1 )) service down "$1" kill_by_name dhcpd kill_by_name nonamed @@ -64,10 +66,10 @@ kill_by_name syslogd sleep 3 if [ X`/bin/sysenv lwip` = Xyes ] then - service up /service/lwip -script /etc/rs.inet -dev /dev/ip + service up /service/lwip -script /etc/rs.inet -dev /dev/ip -restarts $restarts dhcpd --lwip & else - service up /service/inet -script /etc/rs.inet -dev /dev/ip + service up /service/inet -script /etc/rs.inet -dev /dev/ip -restarts $restarts daemonize dhcpd fi daemonize nonamed -L diff --git a/minix/commands/service/service.c b/minix/commands/service/service.c index 0d6c454d4..78a294499 100644 --- a/minix/commands/service/service.c +++ b/minix/commands/service/service.c @@ -84,7 +84,8 @@ static int known_request_types[] = { #define OPT_REUSE "-r" /* reuse executable image */ #define OPT_NOBLOCK "-n" /* unblock caller immediately */ #define OPT_REPLICA "-p" /* create replica for the service */ -#define OPT_BATCH "-b" /* batch mode */ +#define OPT_NO_BIN_EXP "-b" /* no binary exponential backoff */ +#define OPT_BATCH "-q" /* batch mode */ #define OPT_ASR_LU "-a" /* asr update */ #define OPT_PREPARE_ONLY_LU "-o" /* prepare-only update */ #define OPT_FORCE_SELF_LU "-s" /* force self update */ @@ -134,6 +135,7 @@ static int known_request_types[] = { #define ARG_TRG_LABELNAME "-trg-label" /* target label name */ #define ARG_LU_IPC_BL "-ipc_bl" /* IPC blacklist filter */ #define ARG_LU_IPC_WL "-ipc_wl" /* IPC whitelist filter */ +#define ARG_RESTARTS "-restarts" /* number of restarts */ /* The function parse_arguments() verifies and parses the command line * parameters passed to this utility. Request parameters that are needed @@ -154,6 +156,7 @@ static char *req_config = PATH_CONFIG; static int custom_config_file = 0; static int req_lu_state = DEFAULT_LU_STATE; static int req_lu_maxtime = DEFAULT_LU_MAXTIME; +static int req_restarts = 0; static long req_heap_prealloc = 0; static long req_map_prealloc = 0; static int req_sysctl_type = 0; @@ -171,15 +174,16 @@ static void print_usage(char *app_name, char *problem) fprintf(stderr, "Warning, %s\n", problem); fprintf(stderr, "Usage:\n"); fprintf(stderr, - " %s [%s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s %s] (up|run|edit|update) [%s ] [%s ] [%s ] [%s ] [%s ] [%s ] [%s ] [%s ] [%s ] [%s