linux init 요약

created : 2022-07-31T13:13:30+00:00
modified : 2022-07-31T13:17:08+00:00

devops
  • 참고 : https://steady-snail.tistory.com/272
#!/bin/bash
### BEGIN INIT INFO
# Provides:             startup.sh
# Required-Start:       $reboot
# Required-Stop:        $reboot
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Server init script
### END INIT INFO

case "$1" in
  start)
  # run as a specific user
  sudo -u <username> /foo/bar
  # TODO Something..

  ;;
  *)
  echo "Usage: $0 (start)"
  ;;
esac

exit 0
chmod 755 startup.sh
update-rc.d startup.sh defaults
update-rc.d -f startup.sh remove