Cron VPN Client start/scp/stop


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Cron VPN Client start/scp/stop
# 1  
Old 03-07-2011
Cron VPN Client start/scp/stop

Hi,

Anyone can help me on how my script will run on crontab, When I manually run my script, it work. But when I put in cron didn't work.

Code:
#crontab schedule
00 16 * * * /home/scriptdir/myscript.sh

Code:
# myscript.sh
#!/bin/bash
echo "mypassword"| sudo -S /etc/init.d/vpnclient_init start
cd /home/vpnclient
vpnclient connect "myprofile" user myusername pwd mypassword
scp myusername@192.168.2.8:/destination/filename.txt target/filename.txt
echo "mypassword"| sudo -S /etc/init.d/vpnclient_init stop
exit 0

Thanks in Advance,
FSP

Last edited by pludi; 03-07-2011 at 05:48 AM..
# 2  
Old 03-07-2011
Add PATH=path

1. in crontab
first line if supported else add PATH in script

2. In Script
export PATH=/bin:/whatever/bin:/where_my_bin:
... I guess you got the point ... Crontab does not know PATH from where it can pick binaries...

3. Add actual location of each command you run
vpnclient, scp, echo etc are unknown
# 3  
Old 03-07-2011
hi chakrapani,

excellent, it works well. thanks for the help.

regards,
fsp
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Red Hat

Port Forward to VPN client.

Hi all, I can't port forward from WAN to VPN Client. VPN Client Ubuntu 18 192.168.0.16 Port 6000 VPN Gateway for LAN clients Centos 192.168.0.12 Router 192.168.0.1 I can forward to the VPN Client if VPN is not connected if I forward Port 6000 from 192.168.0.1 directly to 192.168.0.16.... (2 Replies)
Discussion started by: stinkefisch
2 Replies

2. IP Networking

VPN Server & Client

First of all, hello. I have a problem installing a vpn server and client. My server is a computer running windows 7, and windows, running a virtual machine running debian. In the debian system, I've the vpn server installed (SoftEther VPN Server) The problems come when I try to connect to... (1 Reply)
Discussion started by: Blues23
1 Replies

3. Solaris

Is there a VPN client that can be used on solaris 10 ?

I need to install VPN client on Solaris 10 server. I searched but only Cisco client was available which requires a service agreement. Please suggest some free ware for this and the steps to do that too as i am net to Solaris Admin tasks. (1 Reply)
Discussion started by: kukretiabhi13
1 Replies

4. Linux

Why service (start|stop) can not be called from cron?

Hi, When I googled, I came to know that I can not call the command "service <service-name> start" from cron, insted I have to specify path to the service-name. I wanted to know the reason. Thanks, Hansini (3 Replies)
Discussion started by: hansini
3 Replies

5. UNIX for Dummies Questions & Answers

Problem when I try to Install a Client VPN Cisco

Hi Gurus of UNIX, I have a problem when I try to install a software VPN Cisco in Laptop (HP530). I do the following procedures: Part 2 - VPN Client Compilation We will now set up the vpn client. As there is no official Cisco VPN Client for OpenSolaris X86 available, we will use vpnc.... (1 Reply)
Discussion started by: andresguillen
1 Replies

6. Red Hat

cisco anyconnect VPN client installation??

Anyone had installed Cisco AnyConnect VPN client on RedHat5.3 EL or CentOS 5.3? I tried on CentOS 5.3 but always getting host unreachable error. Same for windows xp works fine. The error log reports: Sep 1 19:14:03 localhost vpnagent: Function: tableCallbackHandler File: RouteMgr.cpp Line:... (3 Replies)
Discussion started by: zing_foru
3 Replies

7. IP Networking

start a new terminal from a script after opening VPN

Hi all, I am trying to write a script that launch the cisco vpn client from the command line and then connects to a remote host using ssh. When i connect to the cisco vpn using vpnclient client connect the last lines of output from that client is Encryption: 168-bit 3-DES Authentication:... (0 Replies)
Discussion started by: borderblaster
0 Replies

8. IP Networking

Cisco vpn client

Who in the 64 ubuntu adopted cisco vpn client on the wireless network I downloaded the cisco vpn client for linux but run vpn_install make file when an error in cisco with the help of the document read in half a day, nor do I know this vpn client in the 64 systems in use. Who can help me, a... (1 Reply)
Discussion started by: Eason
1 Replies

9. Solaris

How to start/stop cron jobs on live server

Hi, I am working with a company where some times i need to start/stop cron jobs on need basis. I have one option to kill cron daemon.Is it right? Please correct me. Waiting for your reply. Thanks in advance.. (2 Replies)
Discussion started by: varaprasadu
2 Replies

10. Cybersecurity

VPN client for linux?...

I'm looking for an open source VPN client that I can set up on RedHat 7.1. Any suggestion? Thanks in advance. VJ :) (3 Replies)
Discussion started by: vancouver_joe
3 Replies
Login or Register to Ask a Question