Skip to content

Instantly share code, notes, and snippets.

@C0nw0nk
Last active February 2, 2023 14:20
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 C0nw0nk/7e762cba9aa0e7eee41744d51bf19c5d to your computer and use it in GitHub Desktop.
Save C0nw0nk/7e762cba9aa0e7eee41744d51bf19c5d to your computer and use it in GitHub Desktop.
entware synology nas add create scheduled task to run at boot custom script user root
# Create Autostart Task
#
# Create a triggered user-defined task in Task Scheduler.
#
# Goto: DSM > Control Panel > Task Scheduler
# Create > Triggered Task > User Defined Script
# General
# Task: Entware
# User: root
# Event: Boot-up
# Pretask: none
# Task Settings
# Run Command: (see bellow) bash /volume1/entware/entware-synology-nas.sh
#!/bin/sh
echo "setup entware"
# https://github.com/Entware/Entware/wiki/Install-on-Synology-NAS
# Entware optware folder permissions to allow install
sudo chmod 777 /opt*
sudo wget -O - https://bin.entware.net/x64-k3.2/installer/generic.sh | /bin/sh
setup_entware() {
PATH="${PATH:+${PATH}:}/opt/bin"
PATH="${PATH:+${PATH}:}/opt/sbin"
# Entware optware folder permissions to allow install
sudo chmod 777 /opt*
sudo chmod 777 /etc/profile
# Mount/Start Entware
sudo mkdir -p /opt
sudo mount -o bind "/volume1/@Entware/opt" /opt
sudo /opt/etc/init.d/rc.unslung start
# Add Entware Profile in Global Profile
if grep -qF '/opt/etc/profile' /etc/profile; then
echo "Confirmed: Entware Profile in Global Profile"
else
echo "Adding: Entware Profile in Global Profile"
sudo cat >> /etc/profile <<"EOF"
# Load Entware Profile
[ -r "/opt/etc/profile" ] && . /opt/etc/profile
EOF
fi
# Update Entware List
sudo /opt/bin/opkg update
}
setup_entwaire
echo "finished setting up entware"
echo "running plex setup for permissions"
setup_plex () {
echo "setup plex function"
# I/O Stream error fix allow concurrent media files to be read
sudo sysctl fs.inotify.max_user_watches=524288
sudo sysctl fs.inotify.max_queued_events=524288
sudo sysctl fs.inotify.max_user_instances=8192
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
echo fs.inotify.max_queued_events=524288 | sudo tee -a /etc/sysctl.conf
echo fs.inotify.max_user_instances=8192 | sudo tee -a /etc/sysctl.conf
sudo sysctl -p
# Hardware Transcoding requires permissions
sudo chmod 666 /dev/dri/*
#cat /proc/sys/fs/inotify/max_user_instances
#cat /proc/sys/fs/inotify/max_queued_events
#cat /proc/sys/fs/inotify/max_user_watches
}
setup_plex
echo "all done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment