Hi,
I have a problem with one of my scripts. It works perfectly when I run it manually but as soon as I add it to crontab it starts a new process.
After 10 min I have 10 different processes running.
Maybe someone can point me in the right direction (I'm on OpenPLi-2.1-beta-dm800se)?
#!/bin/sh
if ps |grep -v grep |grep -c 1111:localhost ;
then
echo "SSH Tunnel... ok"
else
echo "SSH Tunnel... restarting"
/usr/bin/ssh -y -i /etc/dropbear/dropbear_rsa_host_key -f -R 1111:localhost:23 -N -R 2222:localhost:80 -N user@192.168.0.2 -p 22
fi
Crontab looks like this:
SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
*/1 * * * * /usr/sbin/check.sh
Thanks in advance!
Shell script is not running properly / cronjob
Started by squidden, 25 May 2012 14:06
4 replies to this topic
Re: Shell script is not running properly / cronjob #2
Re: Shell script is not running properly / cronjob #3
Re: Shell script is not running properly / cronjob #4
Posted 25 May 2012 - 20:08
*/1 * * * * = * * * * *, sounds like it's working as expected...
--
hemi
Ps. You might want an exit before the else.
Ahh... so the script should look like this?
#!/bin/sh
if ps |grep -v grep |grep -c 1111:localhost ;
then
echo "SSH Tunnel... ok"
exit
else
echo "SSH Tunnel... restarting"
/usr/bin/ssh -y -i /etc/dropbear/dropbear_rsa_host_key -f -R 1111:localhost:23 -N -R 2222:localhost:80 -N user@192.168.0.2 -p 22
fi
//Squidden
Re: Shell script is not running properly / cronjob #5
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users