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:
I tried to get cron to run this daily, but I get the error message:
/_tomcat_all: /bin/./shutdown.sh: No such file or directory
/_tomcat_all: /bin/./startup.sh: 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?
"/_tomcat_all: /bin/./shutdown.sh: No such file or directory
/_tomcat_all: /bin/./startup.sh: 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:
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?
|All times are GMT -5. The time now is 05:39 AM.|