runvpn.bat
Posted: 30 Sep 2008 05:33
I want to start my vpn connection from runvpn.bat file. The batch file should be as follows :
Check first whether any vpn connection exists. If yes then the batch file will do ftp process to some other server. If the vpn connection doesn't exist then the script will try to establish the vpn connection and then start the ftp process.
I want to do this bcos. if the vpn connection breaks due to any reason then i have to physically attend the machine and restart the vpn. As soon as the vpn connection breaks the ftp process stops. Hence if i am able to check whether the vpn connection is alive or not then if the connection is not alive then the batch file will make the connection alive and continue the ftp process. If it connection is alive then only the ftp process will go on.
For this purpose i have written the script as follows :
set kount=1
"c:\Program Files\Cisco Vpn\Vpn Connection\vpnclient.exe" connect "c:\Program Files\Cisco Vpn\Vpn Connection\Profiles\connectvpn" user abc pwd xyz nocertpwd
if %errorlevel% neq 200 goto failed
:start
ftp -s:ftp1.txt ftp_server_ip/name
kount+=
if kount neq 5 goto start
goto end
:failed
echo failed to connect with error = %errorlevel%
"c:\Program Files\Cisco Vpn\Vpn Connection\vpnclient.exe" connect "c:\Program Files\Cisco Vpn\Vpn Connection\Profiles\connectvpn" user abc pwd xyz nocertpwd
goto start
:end
There maybe some syntax errors. Can it be possible ? If yes, then kindly point me out where i am doing wrong.
- jagdish
Check first whether any vpn connection exists. If yes then the batch file will do ftp process to some other server. If the vpn connection doesn't exist then the script will try to establish the vpn connection and then start the ftp process.
I want to do this bcos. if the vpn connection breaks due to any reason then i have to physically attend the machine and restart the vpn. As soon as the vpn connection breaks the ftp process stops. Hence if i am able to check whether the vpn connection is alive or not then if the connection is not alive then the batch file will make the connection alive and continue the ftp process. If it connection is alive then only the ftp process will go on.
For this purpose i have written the script as follows :
set kount=1
"c:\Program Files\Cisco Vpn\Vpn Connection\vpnclient.exe" connect "c:\Program Files\Cisco Vpn\Vpn Connection\Profiles\connectvpn" user abc pwd xyz nocertpwd
if %errorlevel% neq 200 goto failed
:start
ftp -s:ftp1.txt ftp_server_ip/name
kount+=
if kount neq 5 goto start
goto end
:failed
echo failed to connect with error = %errorlevel%
"c:\Program Files\Cisco Vpn\Vpn Connection\vpnclient.exe" connect "c:\Program Files\Cisco Vpn\Vpn Connection\Profiles\connectvpn" user abc pwd xyz nocertpwd
goto start
:end
There maybe some syntax errors. Can it be possible ? If yes, then kindly point me out where i am doing wrong.
- jagdish