aboutsummaryrefslogtreecommitdiff
path: root/riemann.fmi.uni-sofia.bg/ninit/man/nsvc.man
blob: 557056a9fb8d08e32e6477c47b0d501e069a6cd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
nsvc(8)								       nsvc(8)



NAME
       nsvc - control ninit

SYNOPSIS
       nsvc [ -Sservice ] [ -[uodgpchaitkorRDCLHVWZE] ] service [...]
       nsvc -Ppid service

DESCRIPTION
       nsvc  is	 the  management  interface  to ninit.	service is the service
       directory  name	relative  to  /etc/ninit.   You	  can	also   include
       /etc/ninit/ in the service name.

       Each  service  directory contains control files.	 They are described on
       http://riemann.fmi.uni-sofia.bg/ninit/


       It is possible to make nsvc SUID.

	      chown root.root /bin/nsvc
	      chmod 4711 /bin/nsvc

       Then nsvc opens the pipes /etc/ninit/in, /etc/ninit/out and switches to
       real UID.  If UID is nonzero only limited set of operation are allowed.

OPTIONS
       If no options are given, nsvc will just print a diagnostic  message  to
       stdout, saying if the service is up, down or finished, which PID it has
       if it is up, and for how long it has been in this state.

       Only the service name ALL means all services.


       -Sservice
	      Skip service.  Apply this option immediately after nsvc.	 Don't
	      insert space between S and service.  Examples:
	      nsvc -Sngetty -Ssshd -Slogger -d ALL
	      nsvc -Sngetty -W3 ALL || nsvc -Sngetty -k ALL


       -u -uNumber
	      Up.   If	the  service is not running, start it.	If the service
	      stops, restart it.  If Number is nonzero and the service is down
	      start it after Number seconds.

       -o -oNumber
	      Once.   If the service is down, start it.	 If the service stops,
	      do not restart it.  If Number is	nonzero	 and  the  service  is
	      down,  start  it	after  Number seconds; if it is up, restart it
	      later.

       -d     Down.  If the service is running, send it a TERM signal and then
	      a CONT signal.  After it stops, do not restart it.

       -r     Stop   respawn.	Set  respawn  flag  to	OFF.   This  does  not
	      start/stop the service.

       -R     Start  respawn.	Set  respawn  flag  to	ON.   This  does   not
	      start/stop the service.

       -p     Pause.  Send the service a STOP signal.

       -c     Continue.	 Send the service a CONT signal.

       -h     Hangup.  Send the service a HUP signal.

       -a     Alarm.  Send the service an ALRM signal.

       -i     Interrupt.  Send the service an INT signal.

       -t     Terminate.  Send the service a TERM signal.

       -k     Terminate.  Send the service a KILL signal.

       -g     Get.  Output just the PID.

       -Ppid service
	      Set pid of service.

       -D service
	      Print  dependencies.   This  will print all the names of all the
	      services that were started because  this	services  depended  on
	      them.  Example:
	      nsvc -D default

       -D     Print ninit memory usage statistics.

       -H     Print  history.	This  will  print  the	names of some recently
	      spawned processes.  This is useful if you see a process  looping
	      (initialization  fails and ninit is restarting it all the time).

       -L     Print all services loaded in memory.

       -V     Print version

       -Wnumber
	      Wait at most number seconds service(s) to finish.	 Example:
	      nsvc -d qmail
	      nsvc -W180 qmail || nsvc -k qmail

       -Cnumber -C+number
	      Tell ninit that the service is in CRON mode.  If number is  zero
	      it  disables  CRON  mode.	  Let now=`date +%s`.  If number < now
	      then ninit starts the service immediately, otherwise ninit  will
	      start it latter.	The flag -C+number (if the number is positive)
	      is equaivalent to the following:
	      t=`expr now + number`
	      nsvc -C$t ...

	      To stop foo, which is in CRON mode do:
	      nsvc -C0 foo
	      nsvc -d foo

       -Z -Znumber
	      Zero (free) a service.  This is done with the ninit-reload  pro-
	      gram.  Example:
	      nsvc -Z30 foo
	      This  removes  foo (if such a service exists) and prepares ninit
	      to accept 30 new services approximately.

       -E -Enumber
	      Update ninit environ.  This is  done  by	ninit-reload  program.
	      Example:
	      nsvc -E36 ABC=12 UVW
	      This  updates  the  variable  ABC	 and removes UVW.  It prepares
	      ninit to accept 36 new services approximately.  See the  environ
	      with:
	      tr '\000' '\012' < /proc/1/environ


RETURN CODES
       Generally,  nsvc	 returns zero if everything is OK or 1 on error (could
       not open /etc/ninit/in or /etc/ninit/out or there is  no	 process  with
       the  given name).  In diagnostic mode, it will exit 0 if the service is
       up, 2 if it is down or 3 if it is finished.


ENVIRON
       nsvc uses the variables NINIT_MEMORY and NINIT_HOME.


SEE ALSO
       ninit(8), ninit-scan(8)
       ninit-shutdown(8), nkillall(8), svc(8), msvc(8)



				 Jan 19, 2010			       nsvc(8)