if salt-minion has its grains, for using "salt-call --local config.get PARAM" get the right PARAM, should add "--skip-grains", or the script cant work normal.
* * Improve init script: specifically manage salt configurations rather than arbitrary salt processes
Unfortunately SysV init scripts tend to rummage through PIDs filtering for
appropriate processes to manage. Unfortunately the filters are usually weak
and don't account for similar processes run by other users, PIDs of dead
processes being re-used for completely different executables, etc.. These
weaknesses can result in killing unrelated processes with potentially serious
results.
These improvements to the SysV init script is a complete rewrite with the
following improvements:
* Specifically manage individual salt configurations rather than looking for
salt minion-like processes.
* Obtain salt minion information from the salt configuration - use the
information to manage the specifically configured process.
* Drop all of the platform-specific helper functions that allow the
previously-mentioned weaknesses.
+ Unfortunately this means that the output information may not match the
specific platform (this could easily be corrected).
* Now can manage multiple salt processes started by different users
+ Unfortunately starts/stops/restarts as a group and is unable to manage
them both as a group or as individual processes (this could easily be
corrected)
The new initscript also allows various control variables to be overridden by
environment variables or through settings put in ``/etc/sysconf/salt`` or
``/etc/default/salt``.
:SALTMINION_DEBUG: Dump each line expansion before execution, output system
information on failure. Default: unset
:SALTMINION_BINDIR: Location of ``salt-minion``, ``salt-call`` and other
executables. Default: ``/usr/bin``
:SALTMINION_SYSCONFDIR: The parent directory for the ``salt`` configuration
directory and the ``sysconfig`` or ``default``
directory.
* Add lines that went missing in the rebase+squash
On our RHEL5 systems we're getting 2 and sometimes 3 or more salt-minions started. Somehow the check on /var/run/salt-minion.pid doesn't prevent this.
This patch stops the registered process and kills any further salt-minion processes, first trying -TERM and then -KILL signals.
It may be that other distros would like to use this same logic to tidy up, in which case the new code can be moved into place as appropriate.
This also fixes an issue with sourcing of /etc/rc.d/init.d/functions in
RHEL/CentOS/Fedora/etc., allowing the use of /etc/default/salt to
override environment variables.
With this commit it is possible to use virtualenv with the init scripts.
For example, I have this in my /etc/default/salt:
```
SALTMASTER=/srv/venvs/venv-1/bin/salt-master
SALTMINION=/srv/venvs/venv-1/bin/salt-minion
SALTSYNDIC=/srv/venvs/venv-1/bin/salt-syndic
SALTAPI=/srv/venvs/venv-1/bin/salt-api
PYTHON=/srv/venvs/venv-1/bin/python
```