entries=`ps -ax | grep $1 | grep -v grep | grep -v checkwbd | wc -l`
host=`/bin/hostname`
_host=${host%%.*}
_date=`/bin/date "+%b %d %T"`
if [ $entries -eq 0 ]; then
cd /usr/local/etc/rc.d
./$2 start
/usr/bin/logger -4 -i -t chkservice -p daemon.info $1 crash detected, process restarted
fi
# L10N
NLSPATH=/nonexistent; export NLSPATH
LANG=ru_RU.UTF-8; export LANG
LC_MESSAGES=ru_RU.UTF-8; export LC_MESSAGES
LC_TIME=en_GB.UTF-8; export LC_TIME
LC_NUMERIC=ru_RU.UTF-8; export LC_NUMERIC
# Other
EDITOR=mcedit; export EDITOR
PAGER=less; export PAGER
BLOCKSIZE=K; export BLOCKSIZE
Суть в том, что эти заклинания должны где-то храниться, вопрос где?
В первом случае некоторые команды (нужные user-у) находятся и выполняются под root-ом
# netstat -in
Kernel Interface table
Iface MTU RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg
br0 1500 850276 0 9811 0 138039 0 0 0 BMPRU
eth0 1500 859789 0 1739 0 138070 0 0 0 BMRU
lo 65536 3749 0 0 0 3749 0 0 0 LRU
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib32/pkgconfig:/usr/lib/pkgconfig:/usr/lib32/pkgconfig; export PKG_CONFIG_PATH
_cacrl=`date -r $cadir/$crlfile +%s`
_oldcrl=`date -r $storedir/$crlfile +%s`
if [ $_cacrl -gt $_oldcrl ]; then
echo "Banzai"
fi