This is an old revision of the document!


SDK Script techsupport.are

To upload a techsupport directy to a ftp server use this file:

techsupport.are
/* DESC: This transfers a techsupport to a remote FTP server
 * Copyright (C) 2014 NetModule AG, Switzerland
 */
 
FTP_SERVER = "192.168.1.254";
FTP_USER   = "myuser";
FTP_PASS   = "mypass";
 
now = localtime(time());
timestamp = strftime("%Y%m%d%H%M%S", now);
url = sprintf("ftp://%s/techsupport-%s.zip", FTP_SERVER, timestamp);
 
nb_syslog("uploading techsupport to %s", url);
 
rc = nb_transfer_put(FTP_USER, FTP_PASS, url, "/host/various/techsupport");
if (rc != 0) {
    nb_syslog("FAILED to upload techsupport");
    exit(1);
}
 
nb_syslog("techsupport has been uploaded successfully");
exit(0);

For storing more than one techsupport in the internal flash use following script :

techsupport_subdir.are
path="ts";
dh=opendir(path);
if(dh == -1) {
if ( mkdir(path,0666) == -1 ) {
                nb_syslog("Could not create dir: /%s. Exiting",path);
                exit(1);
                }
} else {
nb_syslog("directory already existent: %s", path);
closedir(dh);
}
timestamp = strftime("%Y%m%d%H%M%S", localtime(time()));
r=file_copy("/host/various/techsupport",sprintf("/%s/ts_%s.zip",path,timestamp));
if(r>0) nb_syslog(sprintf("Created Techsupport-File with size %i kByte /%s/ts_%s.zip",r/1024,path,timestamp));
if(r<0)nb_syslog("FAIL: Could not create Techsupport File");