Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
Last revision Both sides next revision
sdk:scripts:techsupport [2015/05/05 15:04]
127.0.0.1 external edit
sdk:scripts:techsupport [2021/03/25 23:00]
juraschek
Line 1: Line 1:
 ====== SDK Script techsupport.are ====== ====== SDK Script techsupport.are ======
 +To upload a techsupport directy to a ftp server use this file: 
 +
 <code c techsupport.are>​ <code c techsupport.are>​
 /* DESC: This transfers a techsupport to a remote FTP server /* DESC: This transfers a techsupport to a remote FTP server
Line 6: Line 8:
  
 FTP_SERVER = "​192.168.1.254";​ FTP_SERVER = "​192.168.1.254";​
-FTP_USER ​  = "stsc"; +FTP_USER ​  = "myuser"; 
-FTP_PASS ​  = "mlksdf23";+FTP_PASS ​  = "mypass";
  
 now = localtime(time());​ now = localtime(time());​
Line 23: Line 25:
 nb_syslog("​techsupport has been uploaded successfully"​);​ nb_syslog("​techsupport has been uploaded successfully"​);​
 exit(0); exit(0);
 +
 +</​code>​
 +
 +For storing more than one techsupport in the internal flash use following script
 +:
 +
 +<code c 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"​);​
  
 </​code>​ </​code>​