Start On Reboot On Nas

Recommended Posts

I know nothing about linux but, against the odds, I have installed BTSync on my Seagate GoFlex Home NAS and it works as it should. However, I would like it to start on reboot and there seems to be conflicting advice across the web about starting programs in linux and I don't have the knowledge to sort the sheep from the goats.


I would be grateful for any advice from anyone who knows how a GoFlex Home operates or can offer an idiot-proof generic suggestion.



Share this post

Link to post
Share on other sites

I use a script, started by cron every 10 minutes.


The script checks if btsync is running, if not, it tries to start btsync.


Here's the script, named, be sure to run it by user 'apache', also make sure all your btsync folders are owned by user 'apache' (because GoFlex Home mount harddisk with 'apache' as the owner). Change "myuser" to your username, and modify /home/myuser/harddisk if necessary.

#!/bin/sh# this script starts btsync, it can be invoked by cron# make sure execute this script by user apache, like this in /etc/crontab:# */10 * * * * apache /home/myuser/harddisk/bin/ # note:# /home/myuser/harddisk is on your harddisk, not on GoFlex Home's rootfs!    # could be softlink like this:# cd ~; sudo ln -sf "GoFlex Home Personal" harddisk# flag files# create $READYFF after harddisk gets mounted: touch $READYFFREADYFF=/home/myuser/harddisk/flagfile/ if you have $DISABLEBTSYNCFF, btsync will be killedDISABLEBTSYNCFF=/home/myuser/harddisk/flagfile/disable_btsync# btsync# btsync's executableBTSYNC=/home/myuser/harddisk/btsync/btsync  # btsync's configuration fileBTSYNC_CONF=/home/myuser/harddisk/btsync/btsync.myuser.configBTSYNC0=$(basename $BTSYNC)if [ ! -f ${READYFF} ] ; then  exit 0fiif [ ! -x ${BTSYNC} ] ; then  exit 0fipid=$(pgrep -u apache -x ${BTSYNC0})if [ -n "${pid}" ] ; then  # already running  if [ -f ${DISABLEBTSYNCFF} ] ; then    killall -9 ${BTSYNC0}  fi  exit 0fiif [ ! -f ${DISABLEBTSYNCFF} ] ; then  if [ -n "$BTSYNC_CONF" ] ; then    $BTSYNC --config $BTSYNC_CONF  else    $BTSYNC  fifiexit 0

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.