01 > ȸҰ

작성일 : 19-09-28 07:07
systemd service 등록하기
 글쓴이 : 이로직…
조회 : 7,209  


I . Lab Steps l

  1. Insert the SD card and boot your board using an NFS file system
  2. Login to the root file system using:
    user name: root
  3. Change directory to the standard initscript directory/etc/init.d
    cd /etc/init.d
  4. Open a file for editing calledhelloworld.shin the/etc/init.ddirectory.
    vi helloworld.sh
    NOTE:In all of these labs if you are not familiar with vi or would like to use a graphical editor like emacs you can also edit these files on the NFS share you have mounted. For example if using the SDK defaults you can edit the files in the/targetNFS/directory instead.
  5. Add the following lines to the helloworld.sh file
    echo ""
    echo "Hello from Sitara!!!"
    echo ""
  6. Give the init script executable permissions so that it can be run
    chmod +x helloworld.sh
  7. The init script has been created, but it has not been linked into the list of scripts to run on boot. To do so you will need to create a symlink to the script in the proper run level directory. The default run level is 5 so the symlink will be created there.
    cd /etc/rc5.d
    ln -s ../init.d/helloworld.sh S99helloworld
  8. You can now reboot your board using the following command
    init 6

II . systemd

vi /lib/systemd/system/myinit.service

Description=My init scripts



vi /etc/init.d/myinitscript.sh

echo ""
echo "Hello from Sitara!!!"
echo ""