LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-06-2005, 07:57 PM   #1
maxhugen
LQ Newbie
 
Registered: Mar 2003
Location: Sydney, Australia
Distribution: Red Hat 7.1
Posts: 15

Rep: Reputation: 0
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:

$CATALINA_HOME/bin/./shutdown.sh
$CATALINA_HOME/bin/./startup.sh
/usr/local/apache2/bin/./apachectl restart

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?

MTIA!

Max Hugen
ustralia
 
Old 12-06-2005, 08:17 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,337

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
"/_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:

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

---------------------
Steve Stites
 
Old 12-06-2005, 09:42 PM   #3
maxhugen
LQ Newbie
 
Registered: Mar 2003
Location: Sydney, Australia
Distribution: Red Hat 7.1
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks!

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
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
running scripts at boot... thedp SUSE / openSUSE 2 10-17-2005 08:21 AM
running scripts at boot viniosity Ubuntu 3 07-19-2005 08:52 PM
Autostart Samba & Running scripts at boot DocNick Linux - General 5 11-09-2004 05:02 AM
My box hangs when running boot scripts elkrammer Linux - Distributions 5 03-31-2003 07:02 PM
Running scripts at boot time saintt Linux - Software 1 08-09-2002 05:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration