Making a .sh script to check if SSH connection exists and if not then connect
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgO9GURib1T8z7lCwjOGLQaGtrueEthgQ8LO42ZX8cOfTqDK4jvDDpKkLFwf2J49kYCMNW7d4ABih_XCb_2UXdq5fPJDkoyg7-8g_YfRUot-XnaXkNYycsNp7lA5_TW9td0FFpLQ2APzKcZ/s1600/1.jpg)
![Creative The name of the picture](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYQ0N5W1qAOxLP7t7iOM6O6AzbZnkXUy16s7P_CWfOb5UbTQY_aDsc727chyphenhyphen5W4IppVNernMMQeaUFTB_rFzAd95_CDt-tnwN-nBx6JyUp2duGjPaL5-VgNO41AVsA_vu30EJcipdDG409/s400/Clash+Royale+CLAN+TAG%2523URR8PPP.png)
up vote
2
down vote
favorite
I am struggling with writing what I assume should be an easy script.
Basically I have a computer at work, which is hidden behind a NAT to which I don't have access. I need to SSH into this computer, so the only way to do this is to set a reverse port redirect, where this NATted computer will connect to my server at home, while redirecting a port for it self and then I can simply ssh into it through my home server.
The .sh script will be executed by the computer at work every 5 minutes and this is what I would like it to do:
Check if there is an active ssh connection to my server going on and if yes, then simply do nothing and exit the script.
If there is no active connection detected, then connect by executing "ssh me@1.2.3.4 -i key.priv" and exit the script.
If the ssh connection attempt hangs for some reason, for say longer than 2 minutes, then force exit the script (not sure if this is possible to do, if not, then it doesn't have to be there)
Thank you kindly for your advice.
command-line networking bash scripts ssh
add a comment |Â
up vote
2
down vote
favorite
I am struggling with writing what I assume should be an easy script.
Basically I have a computer at work, which is hidden behind a NAT to which I don't have access. I need to SSH into this computer, so the only way to do this is to set a reverse port redirect, where this NATted computer will connect to my server at home, while redirecting a port for it self and then I can simply ssh into it through my home server.
The .sh script will be executed by the computer at work every 5 minutes and this is what I would like it to do:
Check if there is an active ssh connection to my server going on and if yes, then simply do nothing and exit the script.
If there is no active connection detected, then connect by executing "ssh me@1.2.3.4 -i key.priv" and exit the script.
If the ssh connection attempt hangs for some reason, for say longer than 2 minutes, then force exit the script (not sure if this is possible to do, if not, then it doesn't have to be there)
Thank you kindly for your advice.
command-line networking bash scripts ssh
I think you do not need such script, becauseautossh
is already available :) Please review this answer: askubuntu.com/a/1006245/566421
â pa4080
Apr 26 at 9:52
Unfortunately, I do not have access to such fancy programs at the work computer (which is actually a NAS), it has to be through the .sh file.
â Askerman
Apr 26 at 10:02
You mean you do not have permissions to install it?
â pa4080
Apr 26 at 10:11
Something like that, I can't install any extra packages. The whole thing simply has to be made from the .sh script and ssh command.
â Askerman
Apr 26 at 10:15
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I am struggling with writing what I assume should be an easy script.
Basically I have a computer at work, which is hidden behind a NAT to which I don't have access. I need to SSH into this computer, so the only way to do this is to set a reverse port redirect, where this NATted computer will connect to my server at home, while redirecting a port for it self and then I can simply ssh into it through my home server.
The .sh script will be executed by the computer at work every 5 minutes and this is what I would like it to do:
Check if there is an active ssh connection to my server going on and if yes, then simply do nothing and exit the script.
If there is no active connection detected, then connect by executing "ssh me@1.2.3.4 -i key.priv" and exit the script.
If the ssh connection attempt hangs for some reason, for say longer than 2 minutes, then force exit the script (not sure if this is possible to do, if not, then it doesn't have to be there)
Thank you kindly for your advice.
command-line networking bash scripts ssh
I am struggling with writing what I assume should be an easy script.
Basically I have a computer at work, which is hidden behind a NAT to which I don't have access. I need to SSH into this computer, so the only way to do this is to set a reverse port redirect, where this NATted computer will connect to my server at home, while redirecting a port for it self and then I can simply ssh into it through my home server.
The .sh script will be executed by the computer at work every 5 minutes and this is what I would like it to do:
Check if there is an active ssh connection to my server going on and if yes, then simply do nothing and exit the script.
If there is no active connection detected, then connect by executing "ssh me@1.2.3.4 -i key.priv" and exit the script.
If the ssh connection attempt hangs for some reason, for say longer than 2 minutes, then force exit the script (not sure if this is possible to do, if not, then it doesn't have to be there)
Thank you kindly for your advice.
command-line networking bash scripts ssh
asked Apr 26 at 9:25
![](https://lh3.googleusercontent.com/-ZYyhrMLnQF4/AAAAAAAAAAI/AAAAAAAAABM/KrCi5dWxLk4/photo.jpg?sz=32)
![](https://lh3.googleusercontent.com/-ZYyhrMLnQF4/AAAAAAAAAAI/AAAAAAAAABM/KrCi5dWxLk4/photo.jpg?sz=32)
Askerman
351513
351513
I think you do not need such script, becauseautossh
is already available :) Please review this answer: askubuntu.com/a/1006245/566421
â pa4080
Apr 26 at 9:52
Unfortunately, I do not have access to such fancy programs at the work computer (which is actually a NAS), it has to be through the .sh file.
â Askerman
Apr 26 at 10:02
You mean you do not have permissions to install it?
â pa4080
Apr 26 at 10:11
Something like that, I can't install any extra packages. The whole thing simply has to be made from the .sh script and ssh command.
â Askerman
Apr 26 at 10:15
add a comment |Â
I think you do not need such script, becauseautossh
is already available :) Please review this answer: askubuntu.com/a/1006245/566421
â pa4080
Apr 26 at 9:52
Unfortunately, I do not have access to such fancy programs at the work computer (which is actually a NAS), it has to be through the .sh file.
â Askerman
Apr 26 at 10:02
You mean you do not have permissions to install it?
â pa4080
Apr 26 at 10:11
Something like that, I can't install any extra packages. The whole thing simply has to be made from the .sh script and ssh command.
â Askerman
Apr 26 at 10:15
I think you do not need such script, because
autossh
is already available :) Please review this answer: askubuntu.com/a/1006245/566421â pa4080
Apr 26 at 9:52
I think you do not need such script, because
autossh
is already available :) Please review this answer: askubuntu.com/a/1006245/566421â pa4080
Apr 26 at 9:52
Unfortunately, I do not have access to such fancy programs at the work computer (which is actually a NAS), it has to be through the .sh file.
â Askerman
Apr 26 at 10:02
Unfortunately, I do not have access to such fancy programs at the work computer (which is actually a NAS), it has to be through the .sh file.
â Askerman
Apr 26 at 10:02
You mean you do not have permissions to install it?
â pa4080
Apr 26 at 10:11
You mean you do not have permissions to install it?
â pa4080
Apr 26 at 10:11
Something like that, I can't install any extra packages. The whole thing simply has to be made from the .sh script and ssh command.
â Askerman
Apr 26 at 10:15
Something like that, I can't install any extra packages. The whole thing simply has to be made from the .sh script and ssh command.
â Askerman
Apr 26 at 10:15
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Let's assume you are using the following command to establish your SSH connection (I would prefer to use .ssh/config
file that will simplify the ssh command, but this is not mandatory):
ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa
- the options
-fTN
will push the connection into the background - I wrote this leading part, because this set of options is critical for my suggestion below; - the option
-R 2222:127.0.0.1:22
will create the reverse tunnel; - the option
-i $HOME/.ssh/id_rsa
indicates the identity file.
We can use ps -aux | grep "<our command>" | sed '$ d'
to check whether the connection is established or not. Based on this our script could be:
#!/bin/bash
SSH_COMMAND="ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa"
if [[ -z $(ps -aux | grep "$SSH_COMMAND" | sed '$ d') ]]
then exec $SSH_COMMAND
fi
Call this script my_autossh
, place it in ~/bin
and make it executable. Then run crontab -e
and add the following job:
* * * * * $HOME/bin/my_autossh
If you do not want to use Cron, modify the scrip my_autossh
in this way:
#!/bin/bash
SSH_COMMAND="ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa"
while true; do
if [[ -z $(ps -aux | grep "$SSH_COMMAND" | sed '$ d') ]]
then eval $SSH_COMMAND
else sleep 60
fi
done
And use nohup
to push it into the background:
nohup my_autossh >/dev/null 2>&1 &
@dessert, I'm not sure :)ps -aux | grep "$SSH_COMMAND"
will return alsogrep --color=auto ssh user@host -fTN -R 2222:127.0.0.1:22 -i /home/user/.ssh/id_rsa
this is the reason why I cut the last line withsed '$ d'
.
â pa4080
Apr 26 at 11:41
@dessert I just could edit the post myself but on the other hand you are right, too: not allgrep
s of all times were aware of the-q
switch. For instance, AIX 4.3 doesn't know about it as I just verified. The advantage of>/dev/null
is that it always works.
â PerlDuck
Apr 26 at 12:08
@dessert, nice! This works:ps -aux | grep -q "[s]sh user@host -fTN -R 2222:127.0.0.1:22 -i /home/spas/.ssh/id_rsa" && echo true || echo false
. But I can't imagine how to implement the square brackets when I'm using a variable withgrep
. Another way is to use:pgrep -f "$SSH_COMMAND" >/dev/null && echo true || echo false
.
â pa4080
Apr 26 at 14:07
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Let's assume you are using the following command to establish your SSH connection (I would prefer to use .ssh/config
file that will simplify the ssh command, but this is not mandatory):
ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa
- the options
-fTN
will push the connection into the background - I wrote this leading part, because this set of options is critical for my suggestion below; - the option
-R 2222:127.0.0.1:22
will create the reverse tunnel; - the option
-i $HOME/.ssh/id_rsa
indicates the identity file.
We can use ps -aux | grep "<our command>" | sed '$ d'
to check whether the connection is established or not. Based on this our script could be:
#!/bin/bash
SSH_COMMAND="ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa"
if [[ -z $(ps -aux | grep "$SSH_COMMAND" | sed '$ d') ]]
then exec $SSH_COMMAND
fi
Call this script my_autossh
, place it in ~/bin
and make it executable. Then run crontab -e
and add the following job:
* * * * * $HOME/bin/my_autossh
If you do not want to use Cron, modify the scrip my_autossh
in this way:
#!/bin/bash
SSH_COMMAND="ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa"
while true; do
if [[ -z $(ps -aux | grep "$SSH_COMMAND" | sed '$ d') ]]
then eval $SSH_COMMAND
else sleep 60
fi
done
And use nohup
to push it into the background:
nohup my_autossh >/dev/null 2>&1 &
@dessert, I'm not sure :)ps -aux | grep "$SSH_COMMAND"
will return alsogrep --color=auto ssh user@host -fTN -R 2222:127.0.0.1:22 -i /home/user/.ssh/id_rsa
this is the reason why I cut the last line withsed '$ d'
.
â pa4080
Apr 26 at 11:41
@dessert I just could edit the post myself but on the other hand you are right, too: not allgrep
s of all times were aware of the-q
switch. For instance, AIX 4.3 doesn't know about it as I just verified. The advantage of>/dev/null
is that it always works.
â PerlDuck
Apr 26 at 12:08
@dessert, nice! This works:ps -aux | grep -q "[s]sh user@host -fTN -R 2222:127.0.0.1:22 -i /home/spas/.ssh/id_rsa" && echo true || echo false
. But I can't imagine how to implement the square brackets when I'm using a variable withgrep
. Another way is to use:pgrep -f "$SSH_COMMAND" >/dev/null && echo true || echo false
.
â pa4080
Apr 26 at 14:07
add a comment |Â
up vote
2
down vote
accepted
Let's assume you are using the following command to establish your SSH connection (I would prefer to use .ssh/config
file that will simplify the ssh command, but this is not mandatory):
ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa
- the options
-fTN
will push the connection into the background - I wrote this leading part, because this set of options is critical for my suggestion below; - the option
-R 2222:127.0.0.1:22
will create the reverse tunnel; - the option
-i $HOME/.ssh/id_rsa
indicates the identity file.
We can use ps -aux | grep "<our command>" | sed '$ d'
to check whether the connection is established or not. Based on this our script could be:
#!/bin/bash
SSH_COMMAND="ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa"
if [[ -z $(ps -aux | grep "$SSH_COMMAND" | sed '$ d') ]]
then exec $SSH_COMMAND
fi
Call this script my_autossh
, place it in ~/bin
and make it executable. Then run crontab -e
and add the following job:
* * * * * $HOME/bin/my_autossh
If you do not want to use Cron, modify the scrip my_autossh
in this way:
#!/bin/bash
SSH_COMMAND="ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa"
while true; do
if [[ -z $(ps -aux | grep "$SSH_COMMAND" | sed '$ d') ]]
then eval $SSH_COMMAND
else sleep 60
fi
done
And use nohup
to push it into the background:
nohup my_autossh >/dev/null 2>&1 &
@dessert, I'm not sure :)ps -aux | grep "$SSH_COMMAND"
will return alsogrep --color=auto ssh user@host -fTN -R 2222:127.0.0.1:22 -i /home/user/.ssh/id_rsa
this is the reason why I cut the last line withsed '$ d'
.
â pa4080
Apr 26 at 11:41
@dessert I just could edit the post myself but on the other hand you are right, too: not allgrep
s of all times were aware of the-q
switch. For instance, AIX 4.3 doesn't know about it as I just verified. The advantage of>/dev/null
is that it always works.
â PerlDuck
Apr 26 at 12:08
@dessert, nice! This works:ps -aux | grep -q "[s]sh user@host -fTN -R 2222:127.0.0.1:22 -i /home/spas/.ssh/id_rsa" && echo true || echo false
. But I can't imagine how to implement the square brackets when I'm using a variable withgrep
. Another way is to use:pgrep -f "$SSH_COMMAND" >/dev/null && echo true || echo false
.
â pa4080
Apr 26 at 14:07
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Let's assume you are using the following command to establish your SSH connection (I would prefer to use .ssh/config
file that will simplify the ssh command, but this is not mandatory):
ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa
- the options
-fTN
will push the connection into the background - I wrote this leading part, because this set of options is critical for my suggestion below; - the option
-R 2222:127.0.0.1:22
will create the reverse tunnel; - the option
-i $HOME/.ssh/id_rsa
indicates the identity file.
We can use ps -aux | grep "<our command>" | sed '$ d'
to check whether the connection is established or not. Based on this our script could be:
#!/bin/bash
SSH_COMMAND="ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa"
if [[ -z $(ps -aux | grep "$SSH_COMMAND" | sed '$ d') ]]
then exec $SSH_COMMAND
fi
Call this script my_autossh
, place it in ~/bin
and make it executable. Then run crontab -e
and add the following job:
* * * * * $HOME/bin/my_autossh
If you do not want to use Cron, modify the scrip my_autossh
in this way:
#!/bin/bash
SSH_COMMAND="ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa"
while true; do
if [[ -z $(ps -aux | grep "$SSH_COMMAND" | sed '$ d') ]]
then eval $SSH_COMMAND
else sleep 60
fi
done
And use nohup
to push it into the background:
nohup my_autossh >/dev/null 2>&1 &
Let's assume you are using the following command to establish your SSH connection (I would prefer to use .ssh/config
file that will simplify the ssh command, but this is not mandatory):
ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa
- the options
-fTN
will push the connection into the background - I wrote this leading part, because this set of options is critical for my suggestion below; - the option
-R 2222:127.0.0.1:22
will create the reverse tunnel; - the option
-i $HOME/.ssh/id_rsa
indicates the identity file.
We can use ps -aux | grep "<our command>" | sed '$ d'
to check whether the connection is established or not. Based on this our script could be:
#!/bin/bash
SSH_COMMAND="ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa"
if [[ -z $(ps -aux | grep "$SSH_COMMAND" | sed '$ d') ]]
then exec $SSH_COMMAND
fi
Call this script my_autossh
, place it in ~/bin
and make it executable. Then run crontab -e
and add the following job:
* * * * * $HOME/bin/my_autossh
If you do not want to use Cron, modify the scrip my_autossh
in this way:
#!/bin/bash
SSH_COMMAND="ssh user@host -fTN -R 2222:127.0.0.1:22 -i $HOME/.ssh/id_rsa"
while true; do
if [[ -z $(ps -aux | grep "$SSH_COMMAND" | sed '$ d') ]]
then eval $SSH_COMMAND
else sleep 60
fi
done
And use nohup
to push it into the background:
nohup my_autossh >/dev/null 2>&1 &
edited Apr 26 at 18:42
answered Apr 26 at 11:14
![](https://i.stack.imgur.com/Lrlbx.jpg?s=32&g=1)
![](https://i.stack.imgur.com/Lrlbx.jpg?s=32&g=1)
pa4080
12k52255
12k52255
@dessert, I'm not sure :)ps -aux | grep "$SSH_COMMAND"
will return alsogrep --color=auto ssh user@host -fTN -R 2222:127.0.0.1:22 -i /home/user/.ssh/id_rsa
this is the reason why I cut the last line withsed '$ d'
.
â pa4080
Apr 26 at 11:41
@dessert I just could edit the post myself but on the other hand you are right, too: not allgrep
s of all times were aware of the-q
switch. For instance, AIX 4.3 doesn't know about it as I just verified. The advantage of>/dev/null
is that it always works.
â PerlDuck
Apr 26 at 12:08
@dessert, nice! This works:ps -aux | grep -q "[s]sh user@host -fTN -R 2222:127.0.0.1:22 -i /home/spas/.ssh/id_rsa" && echo true || echo false
. But I can't imagine how to implement the square brackets when I'm using a variable withgrep
. Another way is to use:pgrep -f "$SSH_COMMAND" >/dev/null && echo true || echo false
.
â pa4080
Apr 26 at 14:07
add a comment |Â
@dessert, I'm not sure :)ps -aux | grep "$SSH_COMMAND"
will return alsogrep --color=auto ssh user@host -fTN -R 2222:127.0.0.1:22 -i /home/user/.ssh/id_rsa
this is the reason why I cut the last line withsed '$ d'
.
â pa4080
Apr 26 at 11:41
@dessert I just could edit the post myself but on the other hand you are right, too: not allgrep
s of all times were aware of the-q
switch. For instance, AIX 4.3 doesn't know about it as I just verified. The advantage of>/dev/null
is that it always works.
â PerlDuck
Apr 26 at 12:08
@dessert, nice! This works:ps -aux | grep -q "[s]sh user@host -fTN -R 2222:127.0.0.1:22 -i /home/spas/.ssh/id_rsa" && echo true || echo false
. But I can't imagine how to implement the square brackets when I'm using a variable withgrep
. Another way is to use:pgrep -f "$SSH_COMMAND" >/dev/null && echo true || echo false
.
â pa4080
Apr 26 at 14:07
@dessert, I'm not sure :)
ps -aux | grep "$SSH_COMMAND"
will return also grep --color=auto ssh user@host -fTN -R 2222:127.0.0.1:22 -i /home/user/.ssh/id_rsa
this is the reason why I cut the last line with sed '$ d'
.â pa4080
Apr 26 at 11:41
@dessert, I'm not sure :)
ps -aux | grep "$SSH_COMMAND"
will return also grep --color=auto ssh user@host -fTN -R 2222:127.0.0.1:22 -i /home/user/.ssh/id_rsa
this is the reason why I cut the last line with sed '$ d'
.â pa4080
Apr 26 at 11:41
@dessert I just could edit the post myself but on the other hand you are right, too: not all
grep
s of all times were aware of the -q
switch. For instance, AIX 4.3 doesn't know about it as I just verified. The advantage of >/dev/null
is that it always works.â PerlDuck
Apr 26 at 12:08
@dessert I just could edit the post myself but on the other hand you are right, too: not all
grep
s of all times were aware of the -q
switch. For instance, AIX 4.3 doesn't know about it as I just verified. The advantage of >/dev/null
is that it always works.â PerlDuck
Apr 26 at 12:08
@dessert, nice! This works:
ps -aux | grep -q "[s]sh user@host -fTN -R 2222:127.0.0.1:22 -i /home/spas/.ssh/id_rsa" && echo true || echo false
. But I can't imagine how to implement the square brackets when I'm using a variable with grep
. Another way is to use: pgrep -f "$SSH_COMMAND" >/dev/null && echo true || echo false
.â pa4080
Apr 26 at 14:07
@dessert, nice! This works:
ps -aux | grep -q "[s]sh user@host -fTN -R 2222:127.0.0.1:22 -i /home/spas/.ssh/id_rsa" && echo true || echo false
. But I can't imagine how to implement the square brackets when I'm using a variable with grep
. Another way is to use: pgrep -f "$SSH_COMMAND" >/dev/null && echo true || echo false
.â pa4080
Apr 26 at 14:07
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1028338%2fmaking-a-sh-script-to-check-if-ssh-connection-exists-and-if-not-then-connect%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
var $window = $(window),
onScroll = function(e)
var $elem = $('.new-login-left'),
docViewTop = $window.scrollTop(),
docViewBottom = docViewTop + $window.height(),
elemTop = $elem.offset().top,
elemBottom = elemTop + $elem.height();
if ((docViewTop elemBottom))
StackExchange.using('gps', function() StackExchange.gps.track('embedded_signup_form.view', location: 'question_page' ); );
$window.unbind('scroll', onScroll);
;
$window.on('scroll', onScroll);
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
I think you do not need such script, because
autossh
is already available :) Please review this answer: askubuntu.com/a/1006245/566421â pa4080
Apr 26 at 9:52
Unfortunately, I do not have access to such fancy programs at the work computer (which is actually a NAS), it has to be through the .sh file.
â Askerman
Apr 26 at 10:02
You mean you do not have permissions to install it?
â pa4080
Apr 26 at 10:11
Something like that, I can't install any extra packages. The whole thing simply has to be made from the .sh script and ssh command.
â Askerman
Apr 26 at 10:15