When you boot NAS4free from USB and your NAS4free host has only volumes that are encrypted, there is a small challenge to start the Pulse sync service. The encrypted storage is not available when NAS4free is started. First the encryption password must be entered in the NAS4free console.
Here we use a script that checks a couple of things. The script is executed through cron, the freeBSD scheduler. This is the flow of the script:
This is the script:
#!/bin/bash
SERVICE=pulse
PULSEFOLDER=/mnt/r5e/scripts/pulse
PULSE=$PULSEFOLDER/$SERVICE
CONFIG=$PULSEFOLDER/config
LOGFOLDER=$PULSEFOLDER/logs
LOG=$LOGFOLDER/pulse.log
pgrep $SERVICE
result=$?
echo "exit code: ${result}"
if [ "${result}" -eq "0" ] ; then
echo "`date`: $SERVICE service running, everything is fine"
exit 1
fi
if [ ! -f $PULSE ] ; then
echo "File $PULSE does not exist"
exit 2
fi
# --- Start pulse with alternative config folder...
export GOMAXPROCS=2
$PULSE -home $CONFIG >>$LOG &
Place the script in the bin folder, chmod +x {scriptname} and configure cron in the NAS4free console like this:
Now cron will periodically check (every 5 minutes) if NAS4free runs (if OK, exit), if the encrypted storage is available (if not, exit) and else start Pulse.
Happy syncing!
No comments :
Post a Comment