Created
September 15, 2020 08:09
-
-
Save pleasemarkdarkly/27ea4dc15831eeb875096a7660278271 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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