A
A
AlexeyMish2016-04-14 11:11:47
linux
AlexeyMish, 2016-04-14 11:11:47

What is the correct script syntax in bash?

I'm not familiar with Linux systems, I'm trying to create a script.
Please help.
CentOS, 64 bit.
When running in a shell

yes | /usr/src/forticlientsslvpn/forticlientsslvpn_cli --server 178.207.157.170:10443 --vpnuser calluser > /dev/null

You are prompted to enter a password
Password for VPN:

I enter it, the vpn tunnel rises.
The task is to write a script and put it in cron to keep the vpn alive.
This is where my difficulties begin.
1) When doing
#!/bin/sh
### BEGIN INIT INFO
# Provides:  pppd
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Forticlient bkk
# Description: Connect bkk forticlient.
### END INIT INFO
cd /usr/src/forticlientsslvpn/
#empty -f -i in -o out cd /usr/src/forticlientsslvpn/
empty -f -i in -o out yes | /usr/src/forticlientsslvpn/forticlientsslvpn_cli --server 178.207.157.170:10443 --vpnuser user > /dev/null

forticlientsslvpn_cli tries to find certificates in the /root/.fctsslvpn_trustca directory, they are obviously not there. How can I make the script run in the execution context from the /usr/src/forticlientsslvpn/ directory so that it looks for certificates as it is written in the ./helper/ directory (ie /usr/src/forticlientsslvpn/helper/)?
2) how to pass the password to the script to connect to vpn, so that you do not need to enter it manually?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dima Kim, 2016-04-14
@jalpy

what if you make a link to /root/.fctsslvpn_trustca?
and at the expense of the password, maybe there are keys?
forticlientsslvpn_cl --help

B
bukass, 2016-04-14
@bukass

1) A crutch in my opinion.
2) expect to help you

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question