Skip to content

Instantly share code, notes, and snippets.

@pleasemarkdarkly
Created September 15, 2020 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pleasemarkdarkly/27ea4dc15831eeb875096a7660278271 to your computer and use it in GitHub Desktop.
Save pleasemarkdarkly/27ea4dc15831eeb875096a7660278271 to your computer and use it in GitHub Desktop.
#!/bin/bash
# symlinked location: /usr/local/etc/rc.d/entware-startup.sh
# location: /volume1/system/synology_918+/mounts/startup_scripts/entware_startup.sh
SESSION=$(`which date` +"%Y%m%d-%H%M")
SYSTEM_LOG="/root/synology-extra-config.${SESSION}.log"
[ ! -f "${SYSTEM_LOG}" ] && touch "${SYSTEM_LOG}"
function do_start () {
echo "Starting $0…"
mkdir -p /opt
mount -vo bind /volume1/systems/synology_918+/mounts/@Entware/opt /opt
/opt/etc/init.d/rc.unslung start
echo "Started $0…"
}
function do_stop () {
echo "Stopping Entware $0…"
umount /opt
echo "Stopped Entware $0…"
}
function do_restart () {
do_stop
sleep 3
do_start
}
function do_status () {
echo "Status $0…"
echo "Entware /opt mount: " && (grep "/opt " /proc/mounts && echo "mounted" || echo "not mounted")
echo "Status $0…"
}
case "$1" in
start)
do_start | tee -a "${SYSTEM_LOG}"
;;
stop)
do_stop | tee -a "${SYSTEM_LOG}"
;;
status)
do_status | tee -a "${SYSTEM_LOG}"
;;
restart)
do_restart | tee -a "${SYSTEM_LOG}"
;;
*)
echo "Usage: $0 start|stop|restart|status"
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment