Skip to content

Commit

Permalink
[TF-704] Update run on startup script to support chkconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
DamonShi1024 committed Aug 10, 2023
1 parent 0ef670e commit 8cc1dec
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions .ebextensions/99-run-on-startup.config
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,39 @@ files:
group: root
content: |
#!/bin/bash
/home/ec2-user/remount_sftp.sh
### BEGIN INIT INFO
# Provides: run_on_startup.sh
# Required-Start: $local_fs $remote_fs
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: My Custom Startup Script
### END INIT INFO

case "$1" in
start)
echo "Starting run_on_startup..."
/home/ec2-user/remount_sftp.sh
;;
stop)
echo "Umount /mnt/nfs endpoint..."
umount /mnt/nfs/
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

exit 0

commands:
01_run_on_startup:
command: "chmod +x /etc/init.d/run_on_startup.sh"
command: chmod +x /etc/init.d/run_on_startup.sh
02_run_on_startup:
command: "/etc/init.d/run_on_startup.sh"
command: |
chkconfig --add run_on_startup.sh
chkconfig --level 2345 run_on_startup.sh on

0 comments on commit 8cc1dec

Please sign in to comment.