fix: dos2unix some files

This commit is contained in:
AGT EMS
2025-06-19 10:48:08 +08:00
parent 6fee394db0
commit fbd48eb4ee
4 changed files with 99 additions and 97 deletions

2
.gitignore vendored
View File

@@ -24,6 +24,8 @@
*.bak* *.bak*
*.exe *.exe
__debug_bin*.exe __debug_bin*.exe
*.swp
# bin file # bin file
bin/iptrans bin/iptrans

View File

@@ -1,32 +1,32 @@
#!/usr/bin/expect #!/usr/bin/expect
#This script use to init the server keys, it rewrite the known_hosts config file #This script use to init the server keys, it rewrite the known_hosts config file
#This script have 3 parameters #This script have 3 parameters
#remoteip: the ip of the remote server #remoteip: the ip of the remote server
#username: the name for logging in #username: the name for logging in
#userpass: the password for logging in #userpass: the password for logging in
set remoteip [lindex $argv 0] set remoteip [lindex $argv 0]
set username [lindex $argv 1] set username [lindex $argv 1]
set userpass [lindex $argv 2] set userpass [lindex $argv 2]
set timeout 5 set timeout 5
spawn sftp $username@$remoteip spawn sftp $username@$remoteip
expect "*(yes/no)?*" expect "*(yes/no)?*"
send "yes\n" send "yes\n"
expect "*password*" expect "*password*"
send "$userpass\n" send "$userpass\n"
expect "*sftp>*" expect "*sftp>*"
send "quit\n" send "quit\n"
expect eof expect eof
exit exit

View File

@@ -1,31 +1,31 @@
#!/bin/sh #!/bin/sh
#This script parse the result.txt file #This script parse the result.txt file
#to judge whether the operation of sending file is successful #to judge whether the operation of sending file is successful
#The local do not have the Permission to access the remote directory #The local do not have the Permission to access the remote directory
if [ `grep -c "handle" /tmp/result$1.txt` -gt 0 ] ; then if [ `grep -c "handle" /tmp/result$1.txt` -gt 0 ] ; then
`echo 4 >/tmp/temp$1.txt` `echo 4 >/tmp/temp$1.txt`
#echo "The local do not have the Permission to access the remote directory" #echo "The local do not have the Permission to access the remote directory"
exit exit
fi fi
#The name or the password is not fit #The name or the password is not fit
if [ `grep -c "Permission denied" /tmp/result$1.txt` -gt 0 ] ; then if [ `grep -c "Permission denied" /tmp/result$1.txt` -gt 0 ] ; then
`echo 2 >/tmp/temp$1.txt` `echo 2 >/tmp/temp$1.txt`
#echo "The name or the password is not fit" #echo "The name or the password is not fit"
exit exit
fi fi
#Successful #Successful
if [ `grep -c "100%" /tmp/result$1.txt` -gt 0 ] ; then if [ `grep -c "100%" /tmp/result$1.txt` -gt 0 ] ; then
`echo 0 >/tmp/temp$1.txt` `echo 0 >/tmp/temp$1.txt`
#echo "Send the file successfully" #echo "Send the file successfully"
exit exit
fi fi
#The remote server is unavailable #The remote server is unavailable
`echo 1 >/tmp/temp$1.txt` `echo 1 >/tmp/temp$1.txt`
#echo "The remote server is unavailable" #echo "The remote server is unavailable"
exit exit

View File

@@ -1,34 +1,34 @@
#!/usr/bin/expect #!/usr/bin/expect
#This script interative with the remote server, and send the file to it #This script interative with the remote server, and send the file to it
#This script have 6 parameters #This script have 6 parameters
#remoteip: the ip of the remote server #remoteip: the ip of the remote server
#username: the name for logining in #username: the name for logining in
#userpass: the password for logining in #userpass: the password for logining in
#resdir: the directory to store the files #resdir: the directory to store the files
#sendfile: the file to send to the remote server #sendfile: the file to send to the remote server
#desdir: the directory to send the files #desdir: the directory to send the files
set remoteip [lindex $argv 0] set remoteip [lindex $argv 0]
set username [lindex $argv 1] set username [lindex $argv 1]
set userpass [lindex $argv 2] set userpass [lindex $argv 2]
set resdir [lindex $argv 3] set resdir [lindex $argv 3]
set sendfile [lindex $argv 4] set sendfile [lindex $argv 4]
set desdir [lindex $argv 5] set desdir [lindex $argv 5]
set timeout 120 set timeout 120
spawn sftp $username@$remoteip spawn sftp $username@$remoteip
expect "yes/no" {send "yes\n"; expect "*assword: "} "*assword: " expect "yes/no" {send "yes\n"; expect "*assword: "} "*assword: "
send "$userpass\n" send "$userpass\n"
expect "*sftp>*" expect "*sftp>*"
send "cd $desdir\n" send "cd $desdir\n"
send "lcd $resdir\n" send "lcd $resdir\n"
send "put $sendfile\n" send "put $sendfile\n"
expect "*100%*" expect "*100%*"
exit exit