Skip to content

Instantly share code, notes, and snippets.

@Detavern
Last active December 23, 2021 00:34
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Detavern/56e1bdec263fa2e5fbb45f60567d48db to your computer and use it in GitHub Desktop.
Save Detavern/56e1bdec263fa2e5fbb45f60567d48db to your computer and use it in GitHub Desktop.
MEGAcmd startup on Synology DSM

Usage

Make sure you have:

  • installed MEGAcmd package in DSM package center.
  • enabled user home service which located at User->Advanced.
  • set up your MEGAcmd correctly according to MEGAcmd README.

Then:

  • move meganz-init.conf into /etc/init/.
  • make sure your HOME env is matched.

Reboot to check if it works. Enjoy!

# only start this service after share & network both ready
start on runlevel 1 and syno.share.ready and syno.network.ready
# stop the service gracefully if the runlevel changes to 'reboot'
stop on runlevel [06]
# run the scripts as the 'admin' user.
setuid admin
script
# change it if this is not your HOME path
export HOME="/var/services/homes/admin"
LOG_FILE="$HOME/mega-init.log"
cd $HOME
/usr/bin/rm -f $LOG_FILE
/usr/bin/echo "latest startup user: $(whoami)" >> $LOG_FILE
/usr/bin/echo "latest startup home: $HOME" >> $LOG_FILE
/usr/bin/echo "latest startup time: $(date)" >> $LOG_FILE
/usr/bin/echo "check meganz account: $(/usr/local/bin/mega-whoami)" >> $LOG_FILE
end script
@sentience
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment