Check If A Tunnel Is Up - If Not, Log It.

I am using the following command to establish a reverse ssh tunnel with an ssh server

Code:
ssh root@my.hostname.here -R 5001:localhost:22

The server is rebooted every night and the tunnel is established automatically on reboot successfully every time.

What I need to do, is run a check, and if for some reason the tunnel is not established, I want to log it in a log file.

How can I reliably check if the tunnel is up or not?
Keep in mind that other ssh sessions might be active at the time, so I don't want the checking method to pick up any of those successful sessions. It has to check only the tunnel.

Thanks


Similar Content



Convert Txt To 3 Column Html

I have a server sending me a plain text email every day, reporting the below parameters. Its reading them from a text file, and sending them to my email.

How can convert this to a three column html table and send that?

Code:
Sync Total: 1 directory, 4 files, 0 symlinks
---------------------------------
Host Name: host name here
---------------------------------
Group Name: group name here
---------------------------------
Disk Usage: 37%
---------------------------------
CPU Usage: 78%
---------------------------------
Memory Usage: 11%
---------------------------------
Temperatu  44.9'C
---------------------------------
Local IP: 192.168.0.115
---------------------------------
Public IP: public ip here
---------------------------------
Tunnel Port: 5001
---------------------------------
Tunnel Status:
Fri Mar 6 06:23:00 EET 2015 opening reverse tunnel from my_host_he 5001 to 127.0.0.1:22
---------------------------------

Thanks

Reverse Nat Ssh Tunnel - Open More That One Port?

I will be setting up a few raspberry pi's in various locations, and they will be creating reverse nat ssh tunnels to my ssh server.

I need to set up a monitoring server at the server's location to monitor the raspberry pi's through the ssh server. The monitoring agent that will be installed on the raspberry pi's is communicating with the monitoring server on port 4700.

My question is:

Since I am using reverse nat ssh tunnels to connect on the ssh server, I am guessing that port 4700 will not be opened. If this is true, is there a way to also open port 4700 in that tunnel, so the monitoring server can access the remote agent?

Thanks

Trying To Transfer Files Over A Vpn Tunnel

Trying to transfer files over a vpn tunnel from a unix box to a windows box. Send syn and receive a syn/ack and then they keep retransmitting this till it dies. Is it a timing issue or a mtu issue.

Parallel File System Check

Reboot of Linux server consuming more time when there is a file system check (fsck)
Most of our server are using ext3 file system
Is there any possibility to make parallel fsck during reboot ?

Rsync Without A Checksum Check? Centos 7

Hi All,
I am trying to perform an rsync without a check sum verification at the end of the copy.

I have tried both the -W (whole file) and the --no-checksum option and at the end of both file copies it performs a verification.


Code:
[root@centsrv01 /]# nice -n 20 rsync -avz --no-checksum  --bwlimit=2000 --progress /opt/vidconvert/converted/testfile.mp4 /opt/RouterUSB/TV/ChromeCast/
sending incremental file list
testfile.mp4
  1400440237 100%    1.94MB/s    0:11:28 (xfer#1, to-check=0/1)


I am copying from an XFS filesystem to a NTFS (CIFS) file system to a Samba share. Unfortunalty NFS is not an option.

Any Ideas?

Thanks

Can Not Use Phpmyadmin

I have installed phpmyadmin , when access http://192.1010.118.0/phpmyadmin ,it pops the error

Code:
Forbidden

You don't have permission to access /phpmyadmin on this server.

I check the phpmyadmin.conf , I have released "allow all" to all directory .

I also check the /var/log/httpd/error_log, it have the following error , I tried change all files permission to 777 but still not work , would advise what is wrong in my server ? thanks

Code:
[authz_co error] [pid 2525] [client 192.1010.118.0:51878] AH01630: client denied by server configuration: /usr/share/phpMyAdmin

Best Way To Run Two Interdependent Scripts

Hi All,

I have two scripts, the aim of these two scripts is, to check whether a particular script is running or not, if it wont runs, then throw a mail.

How i Achieved this output is, I wrote first script.

I created an infinite while loop which performs below steps

1. It creates a touch file
2. Triggers the script which needs to be monitored if its working or not.
3. Removes the touch file.

If the second step fails, then the remove file command will not happen and the script will stuck there itself.

I created an another script which checks the creation time of the touch file and if it is more than ten minutes, it means the second step in the first script is hanged, which also means that particular script is not working.

So if the creation time is more than 2 minutes the second script will throw a mail.

Below are the two scripts.

Code:
#!/bin/ksh



userid="chansd"

filename="/apps/log/check.txt"

while true ;do
touch $filename
pass=`/apps/eDMZ/call_st.ksh $userid`
sleep 20
rm $filename
done

Below script checks the file creation time and throws email if it is older than 2 minutes
Code:
#!/bin/ksh


filename="/apps/log/check.txt"

if [ -f "${filename}" ]
then
if test "`find $filename -mmin +2`"
then
echo "script is not working ! Please act on it" | mail -s "Script  is not working" Example@mail.com
fi


else

        exit 1

fi


What im going to do is

1. I am going to run the first script in background so it runs forever.
2. I am going to run the second script in cron forevry 5 mins to check the file creation time.

3. So if the first script hangs . I will kill the process using process id and after the issue resolves with the inner script, I will run the main script again.

I am new to Linux, Please let me know if this approach will work as expected.

Cronjob Created Empty Files

Hi All,

I have facing a problem with cron job.
Actually on the client server there are some cronjob scheduled
as follows:

@daily sh_file.sh 2>&1>> /dev/null #Contact: vali.zachia@gmail.com
@hourly php demo.php 2>&1 >> /dev/null
10 2 * * * wget --no-check-certificate url 2>&1 > /dev/null #Cron IE
10 2 * * * wget --no-check-certificate url 2>&1 > /dev/null #cron EN
@daily sh script.sh
@daily sh script.sh
@daily sh script.sh
@hourly wget --no-check-certificate url 2>&1 > /dev/null
@daily wget --no-check-certificate url 2>&1 > /dev/null #Cron Poland
@daily wget --no-check-certificate url 2>&1 > /dev/null #Cron Norway
@daily wget --no-check-certificate url 2>&1 > /dev/null #Cron Portugal
10 2 * * * wget --no-check-certificate url 2>&1 > /dev/null #Cron GR
@daily wget --no-check-certificate url 2>&1 > /dev/null
@daily wget --no-check-certificate url 2>&1 > /dev/null
@daily wget --no-check-certificate url 2>&1 > /dev/null #Denmark



Cronjobs are scheduled daily/hourly.

But what happends after every hour/day there is a blank file created in a folder .

like :
hourly.1

hourly.2
hourly.3
hourly.4

and so on similary for daily scripts.

I am not sure whether these are created by cron job
So please clarify whether cronjob provides some thing like above or it is the code problem

Headless Libreoffice Doesn't Create File

I am trying to convert a PDF document from an Excel and PowerPoint document. I installed it and ran the command. It gives no warning.. Just doesn't create a new PDF document. I've successfully done this before, but I think it was a different server. I've checked file permissions, but don't think it is the issue (I've tried as a normal user and as root).

I could convert doc, docx, and txt files, but not xls, xlsx, ppt, and pptx files.

Thoughts why? Is there a verbose option or a log file which I could check for clues?

Thank you


Code:
yum -y install libreoffice-headless libreoffice-writer

Code:
Package 1:libreoffice-headless-4.0.4.2-14.el6.x86_64 already installed and latest version
Package 1:libreoffice-writer-4.0.4.2-14.el6.x86_64 already installed and latest version

Code:
libreoffice --headless -convert-to pdf myfile.xlsx

Netcat And Nc Commands Not Working In Red Hat Linux 6.4

Hello All,

I am trying to check a tcp/udp port from one server to another server using netcat and nc commands. As there is no manual entry in the system I am not able to check it.

Please let me know any commands are available for checking the port from one server to another server