Having problems running shell script from crontab

2012-01-07 Thread Kaya Saman
Hi, I wrote a shell script to detect if the port of tomcat was in use or not then restart if the port wasn't online; due to tomcat segfaulting as my system hasn't got enough memory for it. This is the shell script: #!/usr/local/bin/bash ntstat=`netstat -ap tcp | grep 8180 | sed -n '1p'`

Re: Having problems running shell script from crontab

2012-01-07 Thread Yuri Pankov
On Sat, Jan 07, 2012 at 02:21:51PM +0200, Kaya Saman wrote: Hi, I wrote a shell script to detect if the port of tomcat was in use or not then restart if the port wasn't online; due to tomcat segfaulting as my system hasn't got enough memory for it. This is the shell script:

Re: Having problems running shell script from crontab

2012-01-07 Thread Kaya Saman
On 01/07/2012 03:05 PM, Yuri Pankov wrote: On Sat, Jan 07, 2012 at 02:21:51PM +0200, Kaya Saman wrote: Hi, I wrote a shell script to detect if the port of tomcat was in use or not then restart if the port wasn't online; due to tomcat segfaulting as my system hasn't got enough memory for it.

Re: Having problems running shell script from crontab

2012-01-07 Thread RW
On Sat, 07 Jan 2012 14:21:51 +0200 Kaya Saman wrote: The strange thing is that if I run this script manually /root/java_restart/java_restart.sh it works fine and does what it's supposed to do. The commonest reason for scripts that that work from a terminal failing under cron is that the

Re: Having problems running shell script from crontab

2012-01-07 Thread Kaya Saman
On 01/07/2012 03:22 PM, RW wrote: On Sat, 07 Jan 2012 14:21:51 +0200 Kaya Saman wrote: The strange thing is that if I run this script manually /root/java_restart/java_restart.sh it works fine and does what it's supposed to do. The commonest reason for scripts that that work from a terminal

Re: Having problems running shell script from crontab

2012-01-07 Thread RW
On Sat, 07 Jan 2012 15:37:49 +0200 Kaya Saman wrote: n terms of paths this is what I'm doing: I'm in a FreeBSD jail logged in by - #jexec jail tcsh which gets me in as root. Crontab is being run as root so paths should be the same no? PATH is set at the top of /etc/crontab

Re: Having problems running shell script from crontab

2012-01-07 Thread Matthew Seaman
On 07/01/2012 13:57, RW wrote: On Sat, 07 Jan 2012 15:37:49 +0200 Kaya Saman wrote: n terms of paths this is what I'm doing: I'm in a FreeBSD jail logged in by - #jexec jail tcsh which gets me in as root. Crontab is being run as root so paths should be the same no? No -- you can't assume

Re: Having problems running shell script from crontab

2012-01-07 Thread Kaya Saman
On 01/07/2012 03:57 PM, RW wrote: On Sat, 07 Jan 2012 15:37:49 +0200 Kaya Saman wrote: n terms of paths this is what I'm doing: I'm in a FreeBSD jail logged in by - #jexecjail tcsh which gets me in as root. Crontab is being run as root so paths should be the same no? PATH is set at the top

Re: Having problems running shell script from crontab

2012-01-07 Thread Kaya Saman
On 01/07/2012 04:30 PM, Matthew Seaman wrote: On 07/01/2012 13:57, RW wrote: On Sat, 07 Jan 2012 15:37:49 +0200 Kaya Saman wrote: n terms of paths this is what I'm doing: I'm in a FreeBSD jail logged in by - #jexecjail tcsh which gets me in as root. Crontab is being run as root so paths