3 if [ "$(id -u)" != 0 ] ; then
4 echo "You must be root to start MLDonkey as daemon."
10 .
/etc
/conf.d
/mldonkey
13 if [ -z $MLDUSER ] ; then
14 echo "Unable to run MLDonkey. You must set a user in /etc/conf.d/mldonkey ."
18 confdir
=$
(su
$MLDUSER -c 'echo $HOME')/.mldonkey
19 pidfile
=${confdir}/mlnet.pid
21 [ -f /tmp
/mldonkey.log
] && rm -f /tmp
/mldonkey.log
25 stat_busy
"Starting MLDonkey"
27 [ ! -d $confdir ] && su
$MLDUSER -c "mkdir -p $confdir"
29 if [ -f $pidfile ] ; then
31 echo "Unable to run MLDonkey, it seems to be already running. If you're sure MLDonkey \
32 is not running, you can remove ${pidfile}."
34 elif [ -f ${confdir}/config_files_space.tmp
] ; then
35 rm -f ${confdir}/config_files_space.tmp
38 su
$MLDUSER -c "/usr/bin/mlnet &> /tmp/mldonkey.log &"
41 while [ "$i" -lt 20 ] ; do
42 if [ ! -z "$(grep "Core started
" /tmp/mldonkey.log)" ] ; then
46 elif [ ! -z "$(grep "This means another MLDonkey
" /tmp/mldonkey.log)" ] ; then
49 elif [ ! -z "$(grep "This is normally caused by another
" /tmp/mldonkey.log)" ] ; then
61 stat_busy
"Stopping MLDonkey"
62 if [ -f $pidfile ] ; then
63 kill $
( cat $pidfile ) &> /dev
/null
66 echo "Unable to stop MLDonkey. It is not running."
86 echo "usage: $0 {start|stop|restart}"