summaryrefslogtreecommitdiffstats
path: root/sbin/rc.M
blob: df6ef1677b3f43dda986810dc6107a5f0cb128f8 (plain) (blame)
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
#!/bin/sh

if [ ! -x /bin/lcdwrite ] ; then alias lcdwrite=/bin/true ; fi 
if [ ! -x /bin/lcdtee ] ; then alias lcdtee=/bin/cat ; fi 

LOG=/var/log/bootlog

function start {
  for service in $* ; do
    echo -n "Starting $service ... " 
    echo -n "$service ... " | lcdwrite
    echo "----- Starting $service with /sbin/init.d/$service -----" >> $LOG
    if [ -x /sbin/init.d/$service ] ; then
      /sbin/init.d/$service start >> $LOG 2>&1 
      if [ $? -eq 0 ] ; then 
        echo "done" | lcdtee
        echo "----- Done -----" >> $LOG
      else 
        echo "failed" | lcdtee
        echo "----- Failed -----" >> $LOG
      fi
    else 
      echo "failed" | lcdtee
      echo "----- Failed -----" >> $LOG
    fi
  done
}


# Reinit /var/log/bootlog file
/bin/rm -rf /var/log/bootlog

# Running multiuser part
echo "Starting Multi-user (`date`)" | tee -a $LOG

# Enable loopback
ip link set dev lo up
ip addr add 127.0.0.1/8 dev lo

# Starting 'crond' if exist
if [ -x /usr/sbin/crond ] ; then
  if [ ! -d /var/spool/cron/crontabs ] ; then mkdir -p /var/spool/cron/crontabs ; fi
  crond
fi

# Starting 'atd' if exist
if [ -x /usr/sbin/atd ] ; then
  atd
fi

# Sourcing base configuration
if [ -x /etc/startup.rc ] ; then
  /etc/startup.rc | tee -a $LOG
elif [ -d /etc/startup.rc ] ; then
  for i in /etc/startup.rc/S* ; do
    $i
  done
else
  echo "No /etc/startup.rc file" | lcdwrite | tee -a $LOG
  echo "No configuration file (/etc/startup.rc)" | tee -a $LOG
fi

# Starting SystemV like daemon
if [ -d /etc/rc$RUNLEVEL.d -a -x /sbin/init.d/sysvinit ] ; then
  /sbin/init.d/sysvinit start | tee -a $LOG
fi

# OK