1. 서비스 만들기


/etc/init.d/rc.local (권한 : -rwxr-xr-x / root)

#! /bin/sh

### BEGIN INIT INFO

# Provides:          rc.local

# Required-Start:    $all

# Required-Stop:

# Default-Start:     2 3 4 5

# Default-Stop:

# Short-Description: Run /etc/rc.local if it exist

### END INIT INFO

 

 

PATH=/sbin:/usr/sbin:/bin:/usr/bin

 

. /lib/init/vars.sh

. /lib/lsb/init-functions

 

do_start() {

        if [ -x /etc/rc.local ]; then

                /etc/rc.local

        fi

}

 

case "$1" in

    start)

        do_start

        ;;

    restart|reload|force-reload)

        echo "Error: argument '$1' not supported" >&2

        exit 3

        ;;

    stop|status)

        # No-op

        exit 0

        ;;

    *)

        echo "Usage: $0 start|stop" >&2

        exit 3

        ;;

esac

 

 

2. 서비스 등록

update-rc.d -f rc.local defaults


3. /etc/rc.local 생성 후 원하는 스크립트 적기 


/etc/rc.local (권한 : -rwxr-xr-x / root)

 #!/bin/bash

# 쓸 내용

exit 0



부록]  virtualbox에 자동 마운트 하기


mount -t vboxsf -o gid=0,uid=0,dmode=700 create32 /root/Desktop (여기서 gid uid는 각 계정 권한에 맞게)


/etc/rc.local

 #!/bin/bash

mount -t vboxsf -o gid=0,uid=0,dmode=700 SharedFolder /root/Desktop

exit 0 




그리고 중요한 것 중 하나가 Virtualbox의 공유폴더 자동 마운트를 해제해야 한다... (자동 마운트시에 umount 발생,,,)




재부팅




« PREV : 1 : ··· : 7 : 8 : 9 : 10 : 11 : 12 : 13 : ··· : 43 : NEXT »