After deeper investigations I think I found a solution to my issues.
* To launch a process during startup, I first used bootlocal.sh that is launched in background by bootsync.sh . After I launched my process in background from bootsync.sh in order to run it sooner.
* For issue about lost connection and home content, I've found some explanations in do_rebootstuff.sh called during startup by bootlocal.sh . In all cases, a backup of user persistent data is done L421:
In do_rebootstuff.sh L421:
# Save the parameters to the config file
echo -n "${BLUE}Updating configuration... ${NORMAL}"
pcp_backup_nohtml >/dev/null 2>&1
echo "${GREEN}Done.${NORMAL}"
In pcp-functions L1182
pcp_backup_nohtml() {
# Delete any previous backup_done file
[ -e /tmp/backup_done ] && sudo rm -f /tmp/backup_done
# Do a backup - filetool.sh backs up files in .filetool.lst
echo -n "[ INFO ] "
sudo filetool.sh -b
sync
# If backup_status file exists and is non-zero in size then an error has occurred
if [ -s /tmp/backup_status ]; then
echo '[ ERROR ] Backup status.'
cat /tmp/backup_status
fi
# If backup_done exists then the backup was successful
if [ -f /tmp/backup_done ]; then
echo '[ OK ] Backup successful.'
else
echo '[ ERROR ] Backup failed.'
fi
}
No flag indicating some parameters have been updated is checked before doing this backup.
But you do not have do_rebootstuff.sh logs you have no idea of precise timing of this backup, e.g. if wifi connection can't be established, backup will be done after several wifi connections are attempted. I preferred commenting out line backuping persistent data and backup it manually when needed.
Moreover, with an home folder of some megas filetool.sh takes lot of time compressing it and writing it to sd, so if you do not have access to do_rebootstuff.sh log you can halt your raspberry when it is still backuping your data. Using tee command in order to write do_rebootstuff.sh logs to stdout and a file in /var/log/do_reboot.log, and checking no tar process is ongoing is useful when rebooting / halting.
Now with these changes, I do not lost some data anymore.
For me, as user do not knwow precisely when this backup is done, it should be done in safe backup mode in pcp_backup_nohtml function. Additionally, when restoring backup fails it could restore saved backup done in safe mode.
lah