remote_bkp/ 0000777 0000000 0000000 00000000000 11302275477 014104 5 ustar admin administrators remote_bkp/inc/ 0000777 0000000 0000000 00000000000 11272333641 014647 5 ustar admin administrators remote_bkp/inc/cfg-remote_bkp.php 0000766 0000000 0000000 00000041215 11327242320 020242 0 ustar admin administrators window.location='$url_npkg&action=setup&npkg=$npkg';";
if ( !isset($_GET['new']) && !isset($_GET['edit']) ) {
// NPKG Configuration page header
$show_enable = true; $show_disable = true; $show_remove = true;
include("npkg_head.php");
// **** RSYNCD ****
// RSyncd processing
if (isset($_POST['RSYNCD'])) {
cgi_bin("npkg.cgi?action=$npkg&config=".$_POST['RR_SEVER_PORT']);
// if (isset($_POST['USE_OF_RSYNC'])) exec(WRITE_HTTP."npkg/remote_bkp.cgi?remote=enable&port=".$_POST['RR_SEVER_PORT'].WRITE_HTTP_END);
// else exec(WRITE_HTTP."npkg/remote_bkp.cgi?remote=disable".WRITE_HTTP_END);
}
// Rsyncd daemon configuration
if (file_exists("$rootdir/.npkg/$npkg/inc/rsyncd.conf")) { // Read from rsyncd.conf if exists
$ini_array = new ini_file("$rootdir/.npkg/$npkg/inc/rsyncd.conf");
$port = $ini_array->get("","port");
$rsyncd = "checked";
} else {
$port = 873;
$rsyncd = "";
}
// Rsyncd web interface
echo "
";
/*
// **** SCHEDULED JOBS ****
// Delete job processing
if (isset($_GET['delete'])) {
$ini_array = new ini_file("$rootdir/.npkg/$npkg/inc/rsync_schedule.conf", true);
$ini_array->remove("Schedule".$_GET['delete']);
// Sort jobs
$i = 0;
foreach($ini_array->ini as $key=>$Section) if ($key != "Global") {
if ($key != "Schedule$i") {
$ini_array->ini["Schedule$i"] = $ini_array->ini[$key];
$ini_array->set("Schedule$i","ID",$i);
unset($ini_array->ini[$key]);
}
$i++;
}
$ini_array->set("Global","Schedule Number",$i);
$ini_array->save();
}
// Read job list
$ini_array = parse_ini_file("$rootdir/.npkg/$npkg/inc/rsync_schedule.conf", true);
echo "UNDER IMPLEMENTATION
";
// *** JOB Web interface
} else {
$ini_array = new ini_file("$rootdir/.npkg/$npkg/inc/rsync_schedule.conf", true);
// Init variable for new job
$jobid = 0; foreach($ini_array->ini as $key=>$Section) if ($key != "Global") $jobid++;
$NAME = "";
$SMB_LOCATION = "";
$RR_CLIENT_PORT = "";
$REMOTE_VOL = "";
$REMOTE_PATH = "";
$SMB_USERNAME = "";
$SMB_PASSWD = "";
$LOCAL_VOL = "";
$LOCAL_PATH = "";
$b_week = "";
$USE_OF_SSH = "";
$backup_type = "";
$b_day = "";
$TIME_HOUR = "";
$TIME_MIN = "";
$RR_SSH_PORT = "";
$COMPRESS = "";
$STOP_SERVICE = "";
$INCREMENTAL_COPY = "";
$REMOVE_EX_FILE = "";
$result = "";
$mode = "new";
// Save job processing
if (isset($_POST['jobid'])) {
$index = "Schedule".$_POST['jobid'];
$ini_array->set($index,"ID",$_POST['jobid']);
$ini_array->set($index,"Name",$_POST['NAME']);
$ini_array->set($index,"Remote Volume",$_POST['REMOTE_VOL']);
$ini_array->set($index,"Remote Path","/".$_POST['REMOTE_PATH']);
$ini_array->set($index,"Local Volume",$_POST['LOCAL_VOL']);
$ini_array->set($index,"Local Path","/".$_POST['LOCAL_PATH']);
$ini_array->set($index,"Remote IP",$_POST['SMB_LOCATION']);
$ini_array->set($index,"User Name",$_POST['SMB_USERNAME']);
$ini_array->set($index,"Password",$_POST['SMB_PASSWD']);
$ini_array->set($index,"Schedule Type",!isset($_POST['backup_type'])?0:$_POST['backup_type']);
$ini_array->set($index,"Week",!isset($_POST['b_day'])?0:$_POST['b_day']);
$ini_array->set($index,"Month",!isset($_POST['b_week'])?0:$_POST['b_week']);
$ini_array->set($index,"Hour",!isset($_POST['TIME_HOUR'])?0:$_POST['TIME_HOUR']);
$ini_array->set($index,"Minute",!isset($_POST['TIME_MIN'])?0:$_POST['TIME_MIN']);
$ini_array->set($index,"Compressed",isset($_POST['COMPRESS'])?"True":"False");
$ini_array->set($index,"Incremental",isset($_POST['INCREMENTAL_COPY'])?"True":"False");
$ini_array->set($index,"Delete Extra",isset($_POST['REMOVE_EX_FILE'])?"True":"False");
$ini_array->set($index,"Stop Net",isset($_POST['STOP_SERVICE'])?"True":"False");
$ini_array->set($index,"Use of SSH",isset($_POST['USE_OF_SSH'])?"True":"False");
$ini_array->set($index,"SSH PORT",isset($_POST['RR_SSH_PORT'])?$_POST['RR_SSH_PORT']:"");
$ini_array->set($index,"RSYNC MODE",$_POST['RR_CLIENT_MODE']);
$ini_array->set($index,"RSYNC PORT",$_POST['RR_CLIENT_PORT']);
$ini_array->set($index,"Status","");
$ini_array->set($index,"Finished Time","");
$ini_array->set("Global","Schedule Number",$_POST['jobid']+1);
// Test or Save
if ($_POST['test'] == 1) {
$ini_array = new ini_file("$rootdir/.npkg/$npkg/inc/rsyncd.conf");
$port = $ini_array->get("","port");
if (trim($_POST['LOCAL_PATH']) == "/") $RR_local_path = $_POST['LOCAL_VOL']; else $RR_local_path = $_POST['LOCAL_VOL']."/".$_POST['LOCAL_PATH'];
if (trim($_POST['REMOTE_PATH']) == "/") $RR_remote_path = $_POST['REMOTE_VOL']; else $RR_remote_path = $_POST['REMOTE_VOL']."/".$_POST['REMOTE_PATH'];
echo "test=$port&".$_POST['SMB_USERNAME']."=".$_POST['SMB_PASSWD']."&local=$RR_local_path&".$_POST['SMB_LOCATION']."=$RR_remote_path";
//exec(WRITE_HTTP."npkg/remote_bkp.cgi?test=$port&".$_POST['SMB_USERNAME']."=".$_POST['SMB_PASSWD']."&local=$RR_local_path&".$_POST['SMB_LOCATION']."=$RR_remote_path".WRITE_HTTP_END);
echo "TEST
";
$output = null; exec("/usr/bin/wget --spider --user=admin --password=lp44-fr8@NTE 192.168.0.180:Public/test/", $output);
foreach ($output as $line) echo "$line
";
$result = "";
} else {
$ini_array->save();
echo $url_npkg_list; // Return to the list
}
}
// Edit job processing
else if ( isset($_GET['edit']) ) {
$jobid = $_GET['edit'];
$index = "Schedule$jobid";
$NAME = $ini_array->get($index,"Name");
$NAME = $ini_array->get($index,"Name");
$RR_CLIENT_MODE = $ini_array->get($index,"RSYNC MODE");
$SMB_LOCATION = $ini_array->get($index,"Remote IP");
$RR_CLIENT_PORT = $ini_array->get($index,"RSYNC PORT");
$REMOTE_VOL = $ini_array->get($index,"Remote Volume");
$REMOTE_PATH = substr($ini_array->get($index,"Remote Path"),1);
$SMB_USERNAME = $ini_array->get($index,"User Name");
$SMB_PASSWD = $ini_array->get($index,"Password");
$LOCAL_VOL = $ini_array->get($index,"Local Volume");
$LOCAL_PATH = substr($ini_array->get($index,"Local Path"),1);
$backup_type = $ini_array->get($index,"Schedule Type");
$b_day = $ini_array->get($index,"Week");
$b_week = $ini_array->get($index,"Month");
$TIME_HOUR = $ini_array->get($index,"Hour");
$TIME_MIN = $ini_array->get($index,"Minute");
$USE_OF_SSH = $ini_array->get($index,"Use of SSH")?"checked":"";
$RR_SSH_PORT = $ini_array->get($index,"SSH PORT");
$COMPRESS = $ini_array->get($index,"Compressed")?"checked":"";
$STOP_SERVICE = $ini_array->get($index,"Stop Net")?"checked":"";
$INCREMENTAL_COPY = $ini_array->get($index,"Incremental")?"checked":"";
$REMOVE_EX_FILE = $ini_array->get($index,"Delete Extra")?"checked":"";
$mode = "edit";
}
// Edit job form
echo "
";
*/
}
?> remote_bkp/inc/rsyncd.conf 0000766 0000000 0000000 00000000575 11327242305 017025 0 ustar admin administrators uid = admin
gid = administrators
pid file = /opt/var/run/rsyncd.pid
read only = false
hosts allow = *
port = 873
[Video]
path = /share/HARD_DISK_A1/Video
[Music]
path = /share/HARD_DISK_A1/Music
[Photo]
path = /share/HARD_DISK_A1/Photo
[Download]
path = /share/HARD_DISK_A1/Download
[USB_DRIVE_A1]
path = /share/external/USB_DRIVE_A1
[OpenNMP]
path = /share/external/USB_DRIVE_A1
remote_bkp/remote_bkp.sh 0000766 0000000 0000000 00000012054 11327243430 016561 0 ustar admin administrators #!/bin/sh
##################################
#
# ABSTRACT: NPKG script for NMP-1000
#
# HISTORY:
# 2009/09/17 Written by Laurent (Ad'Novea)
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details.
#
##################################
#
##################################
# INCLUDE HEADER
##################################
# Load the header file and check if loaded
. /share/OpenNMP/.onmp/header.sh
[ ! -f $USB_BASE/.onmp/header.sh ] && /bin/echo "Header file is missing!" && exit 1
#
##################################
# NPKG
##################################
FILENAME=`$CMD_READLINK -f $0`; FILENAME="${FILENAME##*/}"; NPKG_NAME="${FILENAME%.*}"
NPKG_DIR=$NPKG_INSTALL_PATH/$NPKG_NAME
NPKG_VER="`${CMD_GETCFG} npkg Version -f ${NPKG_DIR}/${NPKG_NAME}.ini`"
#
##################################
# FUNCTIONS
##################################
#
config_rsync()
{
# If no value given set default port value to 873
PORT=$1
[ -z $1 ] && PORT=873
$CMD_ECHO -e "Configure RSync with port ${PORT}"
# Create new rsyncd.conf file with the list of available shared folders
$CMD_RM -Rf $RSYNCD
$CMD_ECHO -e "uid = admin\ngid = administrators\npid file = /opt/var/run/rsyncd.pid\nread only = false\nhosts allow = *\nport = ${PORT}\n" > $RSYNCD
for sharedfolder in `$CMD_SED -n '/\[[^>]*\]/p' /etc/smb.conf`; do
if [ "${sharedfolder}" != "[global]" ]; then
SHARED=`$CMD_ECHO $sharedfolder | $CMD_SED 's/\[//;s/\]//' `
$CMD_ECHO -e $sharedfolder >> $RSYNCD
$CMD_ECHO -e "path = `${CMD_GETCFG} \"${SHARED}\" path -f /etc/smb.conf`" >> $RSYNCD
fi
done
}
#
remote_enable()
{
$CMD_ECHO -e "Allow remote Rsync server which backup data to NAS"
# Update or create the configuration file with the list of Shared folders
[ -f $RSYNCD ] && PORT=`$CMD_GETCFG "" "port" -f $RSYNCD`;
[ ! -f $RSYNCD ] && config_rsync $PORT
# Stop daemon
$CMD_ECHO -e "Stop Rsync daemon"
if [ -f /opt/var/run/rsyncd.pid ]; then $CMD_KILL `cat /opt/var/run/rsyncd.pid`
else $CMD_KILLALL rsync 2>/dev/null; fi
$CMD_RM -f /opt/var/run/rsyncd.pid
# Start daemon as background task
$CMD_ECHO -e "Start Rsync daemon"
# Take into account setting into /opt/etc/default/rsync
[ -e /opt/etc/default/rsync ] && . /opt/etc/default/rsync
[ ${RSYNC_ENABLE} ] && $CMD_RSYNC --daemon ${RSYNC_OPTS} --config=$RSYNCD &
}
#
remote_disable()
{
$CMD_ECHO -e "Disable remote Rsync server which backup data to NAS"
# Stop daemon
if [ -f /opt/var/run/rsyncd.pid ]; then $CMD_KILL `cat /opt/var/run/rsyncd.pid`
else $CMD_KILLALL rsync 2>/dev/null; fi
$CMD_RM /opt/var/run/rsyncd.pid
}
#
##################################
# MAIN
##################################
#
$CMD_ECHO -e "> Entering ${FILENAME} ${1}"
RSYNCD=$NPKG_DIR/inc/rsyncd.conf
case $1 in
# Preinstall is performed while the new NPKG is still in the temporary folder to handle pre-installation operations
preinstall)
# Install required IPKG modules
IPKG_UTILITIES=`$CMD_GETCFG npkg Ipkg -f $USB_BASE/$NPKG_TEMP/$NPKG_NAME/$NPKG_NAME.ini`
install_ipkg "'${IPKG_UTILITIES}'"
# The command line below overwrite previous NPKG files
$CMD_CP -Rf $USB_BASE/$NPKG_TEMP/$NPKG_NAME $NPKG_INSTALL_PATH/
NPKG_INSTALL_MSG="${NPKG_NAME} ${NPKG_VER} successfully preinstalled"; $CMD_ECHO $NPKG_INSTALL_MSG
_exit 0
;;
# Upgrade is performed while the new NPKG is in its final folder
upgrade)
NPKG_INSTALL_MSG="${NPKG_NAME} ${NPKG_VER} successfully upgraded"; $CMD_ECHO $NPKG_INSTALL_MSG
_exit 0
;;
# Install is performed once the NPKG files have been moved (1st install) or copied (upgrade) to their final location
install)
# Stop any previous rsync process and remove previous rsS ans rcK (names are differents)
$CMD_KILLALL rsync
$CMD_RM -f /opt/etc/init.d/S57rsyncd
NPKG_INSTALL_MSG="${NPKG_NAME} ${NPKG_VER} successfully installed"; $CMD_ECHO $NPKG_INSTALL_MSG
_exit 0
;;
# Remove is performed before NPKG deletion
remove)
NPKG_INSTALL_MSG="${NPKG_NAME} ${NPKG_VER} successfully removed"; $CMD_ECHO $NPKG_INSTALL_MSG
_exit 0
;;
# Start the NPKG plugin
start) remote_disable
$CMD_SLEEP 2
remote_enable
NPKG_INSTALL_MSG="${NPKG_NAME} ${NPKG_VER} enabled"; $CMD_ECHO $NPKG_INSTALL_MSG
_exit 0
;;
# Stop the NPKG plugin
stop) remote_disable
NPKG_INSTALL_MSG="${NPKG_NAME} ${NPKG_VER} disabled"; $CMD_ECHO $NPKG_INSTALL_MSG
_exit 0
;;
# Restart the NPKG plugin
restart) ./$0 stop; $CMD_SLEEP 2; ./$0 start
;;
# Change configuration
config) # Check if RSync is running
RUNNING=`$CMD_GETCFG npkg Enable -f $NPKG_DIR/$NPKG_NAME.ini`
[ "${RUNNING}" == "TRUE" ] && remote_disable
config_rsync $2
[ "${RUNNING}" == "TRUE" ] && remote_enable
;;
# Usage or wrong parameters has been passed!
*) $CMD_ECHO "USAGE: ${FILENAME} {start|stop|restart|remote}"; exit 1
;;
esac
exit $? remote_bkp/images/ 0000777 0000000 0000000 00000000000 11266641016 015344 5 ustar admin administrators remote_bkp/images/img-remote_bkp.png 0000766 0000000 0000000 00000013357 11324604634 020765 0 ustar admin administrators PNG
IHDR @ @ iq tEXtSoftware Adobe ImageReadyqe<