-   Linux - Newbie (
-   -   Running Scripts at Boot, via Cron etc (

maxhugen 12-06-2005 07:57 PM

Running Scripts at Boot, via Cron etc
I have a script that stops my Tomcat server, restarts it, and restarts Apache.

It's called /_tomcat_all, and I can run it fine from the command line (as root).

All that's in it is:

/usr/local/apache2/bin/./apachectl restart

I tried to get cron to run this daily, but I get the error message:

/_tomcat_all: /bin/./ No such file or directory

I have the same sort of errors when I tried to get a script to run during boot, via /etc/rc.d/init.d and the default runlevel /etc/rc.d/rc3.d.

Can anone suggest what might be wrong with this please?


Max Hugen

jailbait 12-06-2005 08:17 PM

"/_tomcat_all: /bin/./ No such file or directory
/_tomcat_all: /bin/./ No such file or directory"

The PATH used by a cron job is pretty skimpy. I suggest that you set the PATH as the first statement in your script, for example:

PATH =$PATH:/bin:/usr/local/apache2/bin/

Steve Stites

maxhugen 12-06-2005 09:42 PM


After specifying the path CATALINA_HOME, it must have progressed to the tomcat shutdown and startup scripts - but since they themselves use other paths such as JAVA_HOME, all this still won't work!

Kinda makes cron a bit useless, it seems. Stumps me how running a shell script can't access the PATH just because it's run via cron.

I certainly don't want to circumvent the PATH by adding it to each and every script running under cron - probably cause myself a major headache in the future if I ever change the 'real' PATH!

Is there any way I can run a script daily that has access to the server's PATH?

Cheers, Max
