- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- reset of apache fails in crontab, but works via at...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2001 05:01 AM
тАО05-10-2001 05:01 AM
run by hand: works
run by at job: works
run by batch: works
run by daemon process: works
run by crontab job: fails
run by crontab to run batch job: fails
run by crontab to run at job: fails
I have apache on an hpux11 hp9000 (trusted system). This version of apache uses php and connect to a sybase database via sybperl module. The shell program stops apache, and restarts it after 10 seconds. Apache resets. But the sybase connection is missing.
It seems weird that at and batch work but crontab doesn't. Any ideas?
Steve Post
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2001 05:05 AM
тАО05-10-2001 05:05 AM
Re: reset of apache fails in crontab, but works via at job.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2001 06:21 AM
тАО05-10-2001 06:21 AM
Re: reset of apache fails in crontab, but works via at job.
Best Regards
JGM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2001 10:22 AM
тАО05-10-2001 10:22 AM
Re: reset of apache fails in crontab, but works via at job.
#!/bin/ksh
cd /disk1/apache/mac/bin
./apachectl stop
sleep 10
./apachectl start
The apache has sybperl2.13 and php embedded DEEP inside it.
I looked at the log files. They don't show anything wrong (just the time apache gets reset).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2001 11:32 AM
тАО05-10-2001 11:32 AM
Solutioncron doesn't store enviroment information (PATH, HOME, ..) so try:
#!/bin/ksh
cd /disk1/apache/mac/bin
/disk1/apache/mac/bin/apachectl stop
/usr/bin/sleep 10
/disk1/apache/mac/bin/apachectl start
Good Luck
JGM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-10-2001 12:17 PM
тАО05-10-2001 12:17 PM
Re: reset of apache fails in crontab, but works via at job.
I agree with Juan's point of vue:
You may have env variables that are set when you try, and missing for cron...
Set them in your script...
Good luck
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2001 04:17 AM
тАО05-11-2001 04:17 AM
Re: reset of apache fails in crontab, but works via at job.
If this was the really problem why would it work with at and batch but not cron? Do they run with different environments normally? My guess is there is some type of permissions problem. Some unknown cron-thing tries to use additional files that at and batch don't care about. My next try is to output the environment variables to a text file via at-job, batch-job, and crontab-job, THEN see if there is a difference in the 3 files.
I'll let you know. Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2001 10:31 AM
тАО05-11-2001 10:31 AM
Re: reset of apache fails in crontab, but works via at job.
at now +1 minute <
DO
batch <
DO
and in the
17 * * * * /testenv > /tmp/env.cron
The /tmp/env.cron file (cron's environment), is only 5 lines. The key variable missing is $SYBASE. This is required by sybperl to make success sybase connections in apache. So, this looks like the problem.
Now, why did it not work when I put the entire environment in the file before? I'll figure it out. I bet the SYBASE variable was set, but not exported. So, when apache started, it lost that SYBASE value.
Why are most of the evironmental variables missing when running cron vs at/batch? I'll be able to figure it out by looking at where they are set normally, and checking permissions. But, I'm not worried about it.
Thanks folks. Steve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2001 10:59 AM
тАО05-11-2001 10:59 AM
Re: reset of apache fails in crontab, but works via at job.
just a note ( from at(1) ):
An at or batch job consists of a two-part script stored in /var/spool/cron/atjobs that can be executed by the POSIX shell.
The first part sets up the environment to match the environment when the at or batch command was issued. This includes the current shell environment variables, current directory, umask, and ulimit. Open file descriptors, traps, and priority are lost.
The second part consists of the commands that you entered.
When cron dispatches the job, it starts a POSIX shell to execute the script.
Best Regards
JGM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО05-11-2001 11:43 AM
тАО05-11-2001 11:43 AM
Re: reset of apache fails in crontab, but works via at job.
That makes a lot more sense now. The environment was as of my telnet session. If I run at now+5 minutes<
DO
I can find that file /var/spool/cron/atjobs has 40 lines of UNIX environment and the last line is the "echo testing."